From ba52a1d2bff9d9b985e200e2db5c77e1f2e70286 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Apr 2013 22:05:15 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/mobi/tweak.py | 10 ++++++---- src/calibre/ebooks/mobi/writer2/resources.py | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/calibre/ebooks/mobi/tweak.py b/src/calibre/ebooks/mobi/tweak.py index e738af151c..91b31dc4c1 100644 --- a/src/calibre/ebooks/mobi/tweak.py +++ b/src/calibre/ebooks/mobi/tweak.py @@ -19,7 +19,7 @@ from calibre.ebooks.mobi.reader.mobi8 import Mobi8Reader from calibre.ebooks.conversion.plumber import Plumber, create_oebbook from calibre.customize.ui import (plugin_for_input_format, plugin_for_output_format) -from calibre.utils.ipc.simple_worker import fork_job +from calibre.utils.ipc.simple_worker import fork_job class BadFormat(ValueError): pass @@ -72,7 +72,8 @@ def explode(path, dest, question=lambda x:True): dest), no_output=True)['result'] def set_cover(oeb): - if 'cover' not in oeb.guide or oeb.metadata['cover']: return + if 'cover' not in oeb.guide or oeb.metadata['cover']: + return cover = oeb.guide['cover'] if cover.href in oeb.manifest.hrefs: item = oeb.manifest.hrefs[cover.href] @@ -95,8 +96,9 @@ def rebuild(src_dir, dest_path): if not opf: raise ValueError('No OPF file found in %s'%src_dir) opf = opf[0] - # For debugging, uncomment the following line - # def fork_job(a, b, args=None, no_output=True): do_rebuild(*args) + # For debugging, uncomment the following two lines + # def fork_job(a, b, args=None, no_output=True): + # do_rebuild(*args) fork_job('calibre.ebooks.mobi.tweak', 'do_rebuild', args=(opf, dest_path), no_output=True) diff --git a/src/calibre/ebooks/mobi/writer2/resources.py b/src/calibre/ebooks/mobi/writer2/resources.py index 01ce6a0135..c364e9aa58 100644 --- a/src/calibre/ebooks/mobi/writer2/resources.py +++ b/src/calibre/ebooks/mobi/writer2/resources.py @@ -69,7 +69,8 @@ class Resources(object): cover_href = item.href for item in self.oeb.manifest.values(): - if item.media_type not in OEB_RASTER_IMAGES: continue + if item.media_type not in OEB_RASTER_IMAGES: + continue try: data = self.process_image(item.data) except: @@ -116,8 +117,8 @@ class Resources(object): Add any images that were created after the call to add_resources() ''' for item in self.oeb.manifest.values(): - if (item.media_type not in OEB_RASTER_IMAGES or item.href in - self.item_map): continue + if (item.media_type not in OEB_RASTER_IMAGES or item.href in self.item_map): + continue try: data = self.process_image(item.data) except: