home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_883 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.3 KB  |  55 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
  6. __docformat__ = 'restructuredtext en'
  7. from calibre.ebooks.epub.fix import ePubFixer
  8.  
  9. class Unmanifested(ePubFixer):
  10.     name = 'Fix unmanifested files'
  11.     
  12.     def short_description(self):
  13.         return _('Fix unmanifested files')
  14.  
  15.     short_description = property(short_description)
  16.     
  17.     def long_description(self):
  18.         return _('Fix unmanifested files. epub-fix can either add them to the manifest or delete them as specified by the delete unmanifested option.')
  19.  
  20.     long_description = property(long_description)
  21.     
  22.     def fix_name(self):
  23.         return 'unmanifested'
  24.  
  25.     fix_name = property(fix_name)
  26.     
  27.     def options(self):
  28.         return [
  29.             ('delete_unmanifested', 'bool', False, _('Delete unmanifested files instead of adding them to the manifest'))]
  30.  
  31.     options = property(options)
  32.     
  33.     def run(self, container, opts, log, fix = False):
  34.         dirtied = False
  35.         for name in list(container.manifest_worthy_names()):
  36.             item = container.manifest_item_for_name(name)
  37.             if item is None:
  38.                 log.error(name, 'not in manifest')
  39.                 if fix:
  40.                     if opts.delete_unmanifested:
  41.                         container.delete_name(name)
  42.                         log('\tDeleted')
  43.                     else:
  44.                         container.add_name_to_manifest(name)
  45.                         log('\tAdded to manifest')
  46.                         dirtied = True
  47.                 
  48.             fix
  49.         
  50.         if dirtied:
  51.             container.set(container.opf_name, container.opf)
  52.         
  53.  
  54.  
  55.