home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- __license__ = 'GPL v3'
- __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
- __docformat__ = 'restructuredtext en'
- from calibre.ebooks.epub.fix import ePubFixer
-
- class Unmanifested(ePubFixer):
- name = 'Fix unmanifested files'
-
- def short_description(self):
- return _('Fix unmanifested files')
-
- short_description = property(short_description)
-
- def long_description(self):
- return _('Fix unmanifested files. epub-fix can either add them to the manifest or delete them as specified by the delete unmanifested option.')
-
- long_description = property(long_description)
-
- def fix_name(self):
- return 'unmanifested'
-
- fix_name = property(fix_name)
-
- def options(self):
- return [
- ('delete_unmanifested', 'bool', False, _('Delete unmanifested files instead of adding them to the manifest'))]
-
- options = property(options)
-
- def run(self, container, opts, log, fix = False):
- dirtied = False
- for name in list(container.manifest_worthy_names()):
- item = container.manifest_item_for_name(name)
- if item is None:
- log.error(name, 'not in manifest')
- if fix:
- if opts.delete_unmanifested:
- container.delete_name(name)
- log('\tDeleted')
- else:
- container.add_name_to_manifest(name)
- log('\tAdded to manifest')
- dirtied = True
-
- fix
-
- if dirtied:
- container.set(container.opf_name, container.opf)
-
-
-
-