Not logged in

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

Overview
Comment:Fix extraction of PNG cover files from blorbs
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0c718f8c4fb255519ca179ed63685435973991a5
User & Date: brandon 2018-10-13 17:14:36
Context
2018-10-13
19:15
Add support for twine check-in: 15e453b6ab user: brandon tags: trunk
17:14
Fix extraction of PNG cover files from blorbs check-in: 0c718f8c4f user: brandon tags: trunk
16:38
Catch possible malformed XML check-in: 6dede47dbd user: brandon tags: trunk
Changes

Changes to treatyofbabel/wrappers/blorb.py.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    i = read_int(file_buffer, i)
    pict_i, pict_len = _get_resource(file_buffer, "Pict", i)
    if pict_i is None:
        return None
    description = _get_resource_description(file_buffer, "Pict", i)
    cover_data = file_buffer[pict_i:pict_i + pict_len]
    cover_format = file_buffer[pict_i - 8:pict_i - 4]
    if cover_format == "PNG":
        ext = "png"
        (width, height) = get_png_dim(cover_data)
    elif cover_format == "JPEG":
        ext = "jpg"
        (width, height) = get_jpeg_dim(cover_data)
    else:
        raise BabelError("Unsupported image format")







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    i = read_int(file_buffer, i)
    pict_i, pict_len = _get_resource(file_buffer, "Pict", i)
    if pict_i is None:
        return None
    description = _get_resource_description(file_buffer, "Pict", i)
    cover_data = file_buffer[pict_i:pict_i + pict_len]
    cover_format = file_buffer[pict_i - 8:pict_i - 4]
    if cover_format[:3] == "PNG":
        ext = "png"
        (width, height) = get_png_dim(cover_data)
    elif cover_format == "JPEG":
        ext = "jpg"
        (width, height) = get_jpeg_dim(cover_data)
    else:
        raise BabelError("Unsupported image format")