Ebook viewer: Display EPUB covers again

This commit is contained in:
Kovid Goyal 2009-07-24 14:27:42 -06:00
parent 8670c28c36
commit 15324627dd
3 changed files with 7 additions and 2 deletions

View File

@ -109,6 +109,10 @@ class InputFormatPlugin(Plugin):
#: convenience method, :method:`get_image_collection`.
is_image_collection = False
#: If set to True, the input plugin will perform special processing
#: to make its output suitable for viewing
for_viewer = False
#: Options shared by all Input format plugins. Do not override
#: in sub-classes. Use :member:`options` instead. Every option must be an
#: instance of :class:`OptionRecommendation`.

View File

@ -53,7 +53,6 @@ class EPUBInput(InputFormatPlugin):
traceback.print_exc()
return False
@classmethod
def rationalize_cover(self, opf, log):
guide_cover, guide_elem = None, None
for guide_elem in opf.iterguide():
@ -78,7 +77,8 @@ class EPUBInput(InputFormatPlugin):
# Remove from spine as covers must be treated
# specially
spine[0].getparent().remove(spine[0])
if not self.for_viewer:
spine[0].getparent().remove(spine[0])
guide_elem.set('href', 'calibre_raster_cover.jpg')
from calibre.ebooks.oeb.base import OPF
t = etree.SubElement(elem[0].getparent(), OPF('item'),

View File

@ -134,6 +134,7 @@ class EbookIterator(object):
if hasattr(plumber.opts, 'no_process'):
plumber.opts.no_process = True
plumber.input_plugin.for_viewer = True
self.pathtoopf = plumber.input_plugin(open(plumber.input, 'rb'),
plumber.opts, plumber.input_fmt, self.log,
{}, self.base)