Keep masthead image when generating MOBI periodicals

This commit is contained in:
Kovid Goyal 2009-07-05 08:38:43 -06:00
parent 98fc0ed2fa
commit d6b38a9725

View File

@ -24,6 +24,7 @@ class ManifestTrimmer(object):
def __call__(self, oeb, context):
oeb.logger.info('Trimming unused files from manifest...')
self.opts = context
used = set()
for term in oeb.metadata:
for item in oeb.metadata[term]:
@ -63,5 +64,8 @@ class ManifestTrimmer(object):
unchecked = new
for item in oeb.manifest.values():
if item not in used:
if getattr(self.opts, 'mobi_periodical', False) and \
item.href == 'images/mastheadImage.gif':
continue
oeb.logger.info('Trimming %r from manifest' % item.href)
oeb.manifest.remove(item)