home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1206 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  2.2 KB  |  51 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL 3'
  5. __copyright__ = '2009, John Schember <john@nachtimwald.com>'
  6. __docformat__ = 'restructuredtext en'
  7. from optparse import OptionParser
  8. from calibre.customize.conversion import OptionRecommendation, DummyReporter
  9. from calibre.ebooks.conversion.plumber import Plumber
  10. from calibre.customize.ui import plugin_for_catalog_format
  11. from calibre.utils.logging import Log
  12.  
  13. def gui_convert(input, output, recommendations, notification = DummyReporter(), abort_after_input_dump = False, log = None):
  14.     recommendations = list(recommendations)
  15.     recommendations.append(('verbose', 2, OptionRecommendation.HIGH))
  16.     if log is None:
  17.         log = Log()
  18.     
  19.     plumber = Plumber(input, output, log, report_progress = notification, abort_after_input_dump = abort_after_input_dump)
  20.     plumber.merge_ui_recommendations(recommendations)
  21.     plumber.run()
  22.  
  23.  
  24. def gui_catalog(fmt, title, dbspec, ids, out_file_name, sync, fmt_options, connected_device, notification = DummyReporter(), log = None):
  25.     if log is None:
  26.         log = Log()
  27.     
  28.     db = db
  29.     import calibre.library
  30.     db = db()
  31.     db.catalog_plugin_on_device_temp_mapping = dbspec
  32.     parser = OptionParser()
  33.     args = []
  34.     parser.add_option('--verbose', action = 'store_true', dest = 'verbose', default = True)
  35.     (opts, args) = parser.parse_args()
  36.     opts.catalog_title = title
  37.     opts.connected_device = connected_device
  38.     opts.ids = ids
  39.     opts.search_text = None
  40.     opts.sort_by = None
  41.     opts.sync = sync
  42.     for option in fmt_options:
  43.         if isinstance(fmt_options[option], list):
  44.             setattr(opts, option, ','.join(fmt_options[option]))
  45.             continue
  46.         setattr(opts, option, fmt_options[option])
  47.     
  48.     plugin = plugin_for_catalog_format(fmt)
  49.     return plugin.run(out_file_name, opts, db, notification = notification)
  50.  
  51.