~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/ebooks/mobi/reader/mobi8.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
415
415
                if font['encrypted']:
416
416
                    self.encrypted_fonts.append(href)
417
417
            else:
418
 
                if len(data) == len(PLACEHOLDER_GIF) and data == PLACEHOLDER_GIF:
419
 
                    continue
420
 
                imgtype = what(None, data)
421
 
                if imgtype is None:
422
 
                    from calibre.utils.magick.draw import identify_data
423
 
                    try:
424
 
                        imgtype = identify_data(data)[2]
425
 
                    except Exception:
426
 
                        imgtype = 'unknown'
427
 
                href = 'images/%05d.%s'%(fname_idx, imgtype)
428
 
                with open(href.replace('/', os.sep), 'wb') as f:
429
 
                    f.write(data)
 
418
                if not (len(data) == len(PLACEHOLDER_GIF) and data == PLACEHOLDER_GIF):
 
419
                    imgtype = what(None, data)
 
420
                    if imgtype is None:
 
421
                        from calibre.utils.magick.draw import identify_data
 
422
                        try:
 
423
                            imgtype = identify_data(data)[2]
 
424
                        except Exception:
 
425
                            imgtype = 'unknown'
 
426
                    href = 'images/%05d.%s'%(fname_idx, imgtype)
 
427
                    with open(href.replace('/', os.sep), 'wb') as f:
 
428
                        f.write(data)
430
429
 
431
430
            resource_map.append(href)
432
431