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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2009, John Schember <john@nachtimwald.com>'
  6. __docformat__ = 'restructuredtext en'
  7. import os
  8. from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation
  9. from calibre.ebooks.pdb.header import PdbHeaderReader
  10. from calibre.ebooks.pdb import PDBError, IDENTITY_TO_NAME, get_reader
  11.  
  12. class PDBInput(InputFormatPlugin):
  13.     name = 'PDB Input'
  14.     author = 'John Schember'
  15.     description = 'Convert PDB to HTML'
  16.     file_types = set([
  17.         'pdb'])
  18.     options = set([
  19.         OptionRecommendation(name = 'single_line_paras', recommended_value = False, help = _('Normally calibre treats blank lines as paragraph markers. With this option it will assume that every line represents a paragraph instead.')),
  20.         OptionRecommendation(name = 'print_formatted_paras', recommended_value = False, help = _('Normally calibre treats blank lines as paragraph markers. With this option it will assume that every line starting with an indent (either a tab or 2+ spaces) represents a paragraph. Paragraphs end when the next line that starts with an indent is reached.'))])
  21.     
  22.     def convert(self, stream, options, file_ext, log, accelerators):
  23.         header = PdbHeaderReader(stream)
  24.         Reader = get_reader(header.ident)
  25.         if Reader is None:
  26.             raise PDBError('No reader available for format within container.\n Identity is %s. Book type is %s' % (header.ident, IDENTITY_TO_NAME.get(header.ident, _('Unknown'))))
  27.         Reader is None
  28.         log.debug('Detected ebook format as: %s with identity: %s' % (IDENTITY_TO_NAME[header.ident], header.ident))
  29.         reader = Reader(header, stream, log, options)
  30.         opf = reader.extract_content(os.getcwd())
  31.         return opf
  32.  
  33.  
  34.