Not logged in

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

Overview
Comment:catch unsupported cover images in blorbs
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:006876d44a1af57c9970da86fa0aaf94cfd7fec5
User & Date: brandon 2015-05-05 22:12:06
Context
2015-05-05
22:15
catch nonetype biblio in ifiction check-in: 4786f6c630 user: brandon tags: trunk
22:12
catch unsupported cover images in blorbs check-in: 006876d44a user: brandon tags: trunk
21:53
replace some generic Exceptions with slightly less generic BabelErrors check-in: 90294f9468 user: brandon tags: trunk
Changes

Changes to treatyofbabel/wrappers/blorb.py.

87
88
89
90
91
92
93


94
95
96
97
98
99
100
    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)


    if width is None or height is None:
        raise BabelError("Image corrupted: cannot determine dimensions")
    cover = CoverImage(cover_data, ext, width, height, description)
    return cover


def get_story_file_ifid(file_buffer):







>
>







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    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")
    if width is None or height is None:
        raise BabelError("Image corrupted: cannot determine dimensions")
    cover = CoverImage(cover_data, ext, width, height, description)
    return cover


def get_story_file_ifid(file_buffer):