Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Calculate a new hash IFID for twine games without an embedded IFID.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:290d26e5c934c135e84ece440e52cacf015a60e0
User & Date: brandon 2018-10-13 20:49:25
Context
2018-10-22
21:20
Add non-canonical function to test whether an MZ executable is a Windows PE executable check-in: f5b4bc4ee4 user: brandon tags: trunk
2018-10-13
20:49
Calculate a new hash IFID for twine games without an embedded IFID. check-in: 290d26e5c9 user: brandon tags: trunk
20:38
Support lower-case IFIDs for twine, of course. check-in: 9a58584f25 user: brandon tags: trunk
Changes

Changes to treatyofbabel/formats/twine.py.

16
17
18
19
20
21
22


23
24
25
26
27
28
29
..
58
59
60
61
62
63
64
65
66
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#
#       You should have received a copy of the GNU General Public License
#       along with pyifbabel.  If not, see <http://www.gnu.org/licenses/>.

import re



FORMAT = "twine"
FORMAT_EXT = [".html", ".htm"]
HOME_PAGE = "http://www.twinery.org"
HAS_COVER = False
HAS_META = False

................................................................................
def get_story_file_cover(file_buffer):
    return None


def get_story_file_ifid(file_buffer):
    m = re.search(r'ifid="([A-Za-z0-9-]+)"', file_buffer)
    if m is None:
        return None
    return m.group(1)







>
>







 







|

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
60
61
62
63
64
65
66
67
68
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#
#       You should have received a copy of the GNU General Public License
#       along with pyifbabel.  If not, see <http://www.gnu.org/licenses/>.

import re
import md5
from binascii import hexlify

FORMAT = "twine"
FORMAT_EXT = [".html", ".htm"]
HOME_PAGE = "http://www.twinery.org"
HAS_COVER = False
HAS_META = False

................................................................................
def get_story_file_cover(file_buffer):
    return None


def get_story_file_ifid(file_buffer):
    m = re.search(r'ifid="([A-Za-z0-9-]+)"', file_buffer)
    if m is None:
        return hexlify(md5.new(file_buffer).digest()).upper()
    return m.group(1)