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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import os.path as os
  5. __license__ = 'GPL v3'
  6. __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
  7. import textwrap
  8. import os
  9. import glob
  10. from calibre.customize import FileTypePlugin, MetadataReaderPlugin, MetadataWriterPlugin, PreferencesPlugin, InterfaceActionBase
  11. from calibre.constants import numeric_version
  12. from calibre.ebooks.metadata.archive import ArchiveExtract, get_cbz_metadata
  13.  
  14. class HTML2ZIP(FileTypePlugin):
  15.     name = 'HTML to ZIP'
  16.     author = 'Kovid Goyal'
  17.     description = textwrap.dedent(_('Follow all local links in an HTML file and create a ZIP file containing all linked files. This plugin is run every time you add an HTML file to the library.'))
  18.     version = numeric_version
  19.     file_types = set([
  20.         'html',
  21.         'htm',
  22.         'xhtml',
  23.         'xhtm',
  24.         'shtm',
  25.         'shtml'])
  26.     supported_platforms = [
  27.         'windows',
  28.         'osx',
  29.         'linux']
  30.     on_import = True
  31.     
  32.     def run(self, htmlfile):
  33.         TemporaryDirectory = TemporaryDirectory
  34.         import calibre.ptempfile
  35.         gui_convert = gui_convert
  36.         import calibre.gui2.convert.gui_conversion
  37.         OptionRecommendation = OptionRecommendation
  38.         import calibre.customize.conversion
  39.         initialize_container = initialize_container
  40.         import calibre.ebooks.epub
  41.         
  42.         try:
  43.             tdir = _[1]
  44.             recs = [
  45.                 ('debug_pipeline', tdir, OptionRecommendation.HIGH)]
  46.             recs.append([
  47.                 'keep_ligatures',
  48.                 True,
  49.                 OptionRecommendation.HIGH])
  50.             gui_convert(htmlfile, tdir, recs, abort_after_input_dump = True)
  51.             of = self.temporary_file('_plugin_html2zip.zip')
  52.             tdir = os.path.join(tdir, 'input')
  53.             opf = glob.glob(os.path.join(tdir, '*.opf'))[0]
  54.             ncx = glob.glob(os.path.join(tdir, '*.ncx'))
  55.             if ncx:
  56.                 os.remove(ncx[0])
  57.             
  58.             epub = initialize_container(of.name, os.path.basename(opf))
  59.             epub.add_dir(tdir)
  60.             epub.close()
  61.         finally:
  62.             pass
  63.  
  64.         return of.name
  65.  
  66.     
  67.     def customization_help(self, gui = False):
  68.         return _('Character encoding for the input HTML files. Common choices include: cp1252, latin1, iso-8859-1 and utf-8.')
  69.  
  70.  
  71.  
  72. class PML2PMLZ(FileTypePlugin):
  73.     name = 'PML to PMLZ'
  74.     author = 'John Schember'
  75.     description = _('Create a PMLZ archive containing the PML file and all images in the directory pmlname_img or images. This plugin is run every time you add a PML file to the library.')
  76.     version = numeric_version
  77.     file_types = set([
  78.         'pml'])
  79.     supported_platforms = [
  80.         'windows',
  81.         'osx',
  82.         'linux']
  83.     on_import = True
  84.     
  85.     def run(self, pmlfile):
  86.         import zipfile
  87.         of = self.temporary_file('_plugin_pml2pmlz.pmlz')
  88.         pmlz = zipfile.ZipFile(of.name, 'w')
  89.         pmlz.write(pmlfile, os.path.basename(pmlfile), zipfile.ZIP_DEFLATED)
  90.         pml_img = os.path.splitext(pmlfile)[0] + '_img'
  91.         i_img = os.path.join(os.path.dirname(pmlfile), 'images')
  92.         if os.path.isdir(pml_img):
  93.             pass
  94.         elif os.path.isdir(i_img):
  95.             pass
  96.         
  97.         img_dir = ''
  98.         if img_dir:
  99.             for image in glob.glob(os.path.join(img_dir, '*.png')):
  100.                 pmlz.write(image, os.path.join('images', os.path.basename(image)))
  101.             
  102.         
  103.         pmlz.close()
  104.         return of.name
  105.  
  106.  
  107.  
  108. class ComicMetadataReader(MetadataReaderPlugin):
  109.     name = 'Read comic metadata'
  110.     file_types = set([
  111.         'cbr',
  112.         'cbz'])
  113.     description = _('Extract cover from comic files')
  114.     
  115.     def get_metadata(self, stream, ftype):
  116.         if ftype == 'cbr':
  117.             extract_first = extract_member
  118.             import calibre.libunrar
  119.             extract_first
  120.         else:
  121.             extract_first = extract_member
  122.             import calibre.libunzip
  123.         MetaInformation = MetaInformation
  124.         import calibre.ebooks.metadata
  125.         ret = extract_first(stream)
  126.         mi = MetaInformation(None, None)
  127.         stream.seek(0)
  128.         if ftype == 'cbz':
  129.             
  130.             try:
  131.                 mi.smart_update(get_cbz_metadata(stream))
  132.  
  133.         
  134.         if ret is not None:
  135.             (path, data) = ret
  136.             ext = os.path.splitext(path)[1][1:]
  137.             mi.cover_data = (ext.lower(), data)
  138.         
  139.         return mi
  140.  
  141.  
  142.  
  143. class CHMMetadataReader(MetadataReaderPlugin):
  144.     name = 'Read CHM metadata'
  145.     file_types = set([
  146.         'chm'])
  147.     description = _('Read metadata from %s files') % 'CHM'
  148.     
  149.     def get_metadata(self, stream, ftype):
  150.         get_metadata = get_metadata
  151.         import calibre.ebooks.chm.metadata
  152.         return get_metadata(stream)
  153.  
  154.  
  155.  
  156. class EPUBMetadataReader(MetadataReaderPlugin):
  157.     name = 'Read EPUB metadata'
  158.     file_types = set([
  159.         'epub'])
  160.     description = _('Read metadata from %s files') % 'EPUB'
  161.     
  162.     def get_metadata(self, stream, ftype):
  163.         get_metadata = get_metadata
  164.         get_quick_metadata = get_quick_metadata
  165.         import calibre.ebooks.metadata.epub
  166.         if self.quick:
  167.             return get_quick_metadata(stream)
  168.         return get_metadata(stream)
  169.  
  170.  
  171.  
  172. class FB2MetadataReader(MetadataReaderPlugin):
  173.     name = 'Read FB2 metadata'
  174.     file_types = set([
  175.         'fb2'])
  176.     description = _('Read metadata from %s files') % 'FB2'
  177.     
  178.     def get_metadata(self, stream, ftype):
  179.         get_metadata = get_metadata
  180.         import calibre.ebooks.metadata.fb2
  181.         return get_metadata(stream)
  182.  
  183.  
  184.  
  185. class HTMLMetadataReader(MetadataReaderPlugin):
  186.     name = 'Read HTML metadata'
  187.     file_types = set([
  188.         'html'])
  189.     description = _('Read metadata from %s files') % 'HTML'
  190.     
  191.     def get_metadata(self, stream, ftype):
  192.         get_metadata = get_metadata
  193.         import calibre.ebooks.metadata.html
  194.         return get_metadata(stream)
  195.  
  196.  
  197.  
  198. class IMPMetadataReader(MetadataReaderPlugin):
  199.     name = 'Read IMP metadata'
  200.     file_types = set([
  201.         'imp'])
  202.     description = _('Read metadata from %s files') % 'IMP'
  203.     author = 'Ashish Kulkarni'
  204.     
  205.     def get_metadata(self, stream, ftype):
  206.         get_metadata = get_metadata
  207.         import calibre.ebooks.metadata.imp
  208.         return get_metadata(stream)
  209.  
  210.  
  211.  
  212. class LITMetadataReader(MetadataReaderPlugin):
  213.     name = 'Read LIT metadata'
  214.     file_types = set([
  215.         'lit'])
  216.     description = _('Read metadata from %s files') % 'LIT'
  217.     
  218.     def get_metadata(self, stream, ftype):
  219.         get_metadata = get_metadata
  220.         import calibre.ebooks.metadata.lit
  221.         return get_metadata(stream)
  222.  
  223.  
  224.  
  225. class LRFMetadataReader(MetadataReaderPlugin):
  226.     name = 'Read LRF metadata'
  227.     file_types = set([
  228.         'lrf'])
  229.     description = _('Read metadata from %s files') % 'LRF'
  230.     
  231.     def get_metadata(self, stream, ftype):
  232.         get_metadata = get_metadata
  233.         import calibre.ebooks.lrf.meta
  234.         return get_metadata(stream)
  235.  
  236.  
  237.  
  238. class LRXMetadataReader(MetadataReaderPlugin):
  239.     name = 'Read LRX metadata'
  240.     file_types = set([
  241.         'lrx'])
  242.     description = _('Read metadata from %s files') % 'LRX'
  243.     
  244.     def get_metadata(self, stream, ftype):
  245.         get_metadata = get_metadata
  246.         import calibre.ebooks.metadata.lrx
  247.         return get_metadata(stream)
  248.  
  249.  
  250.  
  251. class MOBIMetadataReader(MetadataReaderPlugin):
  252.     name = 'Read MOBI metadata'
  253.     file_types = set([
  254.         'mobi',
  255.         'prc',
  256.         'azw'])
  257.     description = _('Read metadata from %s files') % 'MOBI'
  258.     
  259.     def get_metadata(self, stream, ftype):
  260.         get_metadata = get_metadata
  261.         import calibre.ebooks.mobi.reader
  262.         return get_metadata(stream)
  263.  
  264.  
  265.  
  266. class ODTMetadataReader(MetadataReaderPlugin):
  267.     name = 'Read ODT metadata'
  268.     file_types = set([
  269.         'odt'])
  270.     description = _('Read metadata from %s files') % 'ODT'
  271.     
  272.     def get_metadata(self, stream, ftype):
  273.         get_metadata = get_metadata
  274.         import calibre.ebooks.metadata.odt
  275.         return get_metadata(stream)
  276.  
  277.  
  278.  
  279. class OPFMetadataReader(MetadataReaderPlugin):
  280.     name = 'Read OPF metadata'
  281.     file_types = set([
  282.         'opf'])
  283.     description = _('Read metadata from %s files') % 'OPF'
  284.     
  285.     def get_metadata(self, stream, ftype):
  286.         OPF = OPF
  287.         import calibre.ebooks.metadata.opf2
  288.         return OPF(stream, os.getcwd()).to_book_metadata()
  289.  
  290.  
  291.  
  292. class PDBMetadataReader(MetadataReaderPlugin):
  293.     name = 'Read PDB metadata'
  294.     file_types = set([
  295.         'pdb'])
  296.     description = _('Read metadata from %s files') % 'PDB'
  297.     author = 'John Schember'
  298.     
  299.     def get_metadata(self, stream, ftype):
  300.         get_metadata = get_metadata
  301.         import calibre.ebooks.metadata.pdb
  302.         return get_metadata(stream)
  303.  
  304.  
  305.  
  306. class PDFMetadataReader(MetadataReaderPlugin):
  307.     name = 'Read PDF metadata'
  308.     file_types = set([
  309.         'pdf'])
  310.     description = _('Read metadata from %s files') % 'PDF'
  311.     
  312.     def get_metadata(self, stream, ftype):
  313.         get_metadata = get_metadata
  314.         get_quick_metadata = get_quick_metadata
  315.         import calibre.ebooks.metadata.pdf
  316.         if self.quick:
  317.             return get_quick_metadata(stream)
  318.         return get_metadata(stream)
  319.  
  320.  
  321.  
  322. class PMLMetadataReader(MetadataReaderPlugin):
  323.     name = 'Read PML metadata'
  324.     file_types = set([
  325.         'pml',
  326.         'pmlz'])
  327.     description = _('Read metadata from %s files') % 'PML'
  328.     author = 'John Schember'
  329.     
  330.     def get_metadata(self, stream, ftype):
  331.         get_metadata = get_metadata
  332.         import calibre.ebooks.metadata.pml
  333.         return get_metadata(stream)
  334.  
  335.  
  336.  
  337. class RARMetadataReader(MetadataReaderPlugin):
  338.     name = 'Read RAR metadata'
  339.     file_types = set([
  340.         'rar'])
  341.     description = _('Read metadata from ebooks in RAR archives')
  342.     
  343.     def get_metadata(self, stream, ftype):
  344.         get_metadata = get_metadata
  345.         import calibre.ebooks.metadata.rar
  346.         return get_metadata(stream)
  347.  
  348.  
  349.  
  350. class RBMetadataReader(MetadataReaderPlugin):
  351.     name = 'Read RB metadata'
  352.     file_types = set([
  353.         'rb'])
  354.     description = _('Read metadata from %s files') % 'RB'
  355.     author = 'Ashish Kulkarni'
  356.     
  357.     def get_metadata(self, stream, ftype):
  358.         get_metadata = get_metadata
  359.         import calibre.ebooks.metadata.rb
  360.         return get_metadata(stream)
  361.  
  362.  
  363.  
  364. class RTFMetadataReader(MetadataReaderPlugin):
  365.     name = 'Read RTF metadata'
  366.     file_types = set([
  367.         'rtf'])
  368.     description = _('Read metadata from %s files') % 'RTF'
  369.     
  370.     def get_metadata(self, stream, ftype):
  371.         get_metadata = get_metadata
  372.         import calibre.ebooks.metadata.rtf
  373.         return get_metadata(stream)
  374.  
  375.  
  376.  
  377. class SNBMetadataReader(MetadataReaderPlugin):
  378.     name = 'Read SNB metadata'
  379.     file_types = set([
  380.         'snb'])
  381.     description = _('Read metadata from %s files') % 'SNB'
  382.     author = 'Li Fanxi'
  383.     
  384.     def get_metadata(self, stream, ftype):
  385.         get_metadata = get_metadata
  386.         import calibre.ebooks.metadata.snb
  387.         return get_metadata(stream)
  388.  
  389.  
  390.  
  391. class TOPAZMetadataReader(MetadataReaderPlugin):
  392.     name = 'Read Topaz metadata'
  393.     file_types = set([
  394.         'tpz',
  395.         'azw1'])
  396.     description = _('Read metadata from %s files') % 'MOBI'
  397.     
  398.     def get_metadata(self, stream, ftype):
  399.         get_metadata = get_metadata
  400.         import calibre.ebooks.metadata.topaz
  401.         return get_metadata(stream)
  402.  
  403.  
  404.  
  405. class TXTMetadataReader(MetadataReaderPlugin):
  406.     name = 'Read TXT metadata'
  407.     file_types = set([
  408.         'txt'])
  409.     description = _('Read metadata from %s files') % 'TXT'
  410.     author = 'John Schember'
  411.     
  412.     def get_metadata(self, stream, ftype):
  413.         get_metadata = get_metadata
  414.         import calibre.ebooks.metadata.txt
  415.         return get_metadata(stream)
  416.  
  417.  
  418.  
  419. class ZipMetadataReader(MetadataReaderPlugin):
  420.     name = 'Read ZIP metadata'
  421.     file_types = set([
  422.         'zip',
  423.         'oebzip'])
  424.     description = _('Read metadata from ebooks in ZIP archives')
  425.     
  426.     def get_metadata(self, stream, ftype):
  427.         get_metadata = get_metadata
  428.         import calibre.ebooks.metadata.zip
  429.         return get_metadata(stream)
  430.  
  431.  
  432.  
  433. class EPUBMetadataWriter(MetadataWriterPlugin):
  434.     name = 'Set EPUB metadata'
  435.     file_types = set([
  436.         'epub'])
  437.     description = _('Set metadata in %s files') % 'EPUB'
  438.     
  439.     def set_metadata(self, stream, mi, type):
  440.         set_metadata = set_metadata
  441.         import calibre.ebooks.metadata.epub
  442.         set_metadata(stream, mi, apply_null = self.apply_null)
  443.  
  444.  
  445.  
  446. class LRFMetadataWriter(MetadataWriterPlugin):
  447.     name = 'Set LRF metadata'
  448.     file_types = set([
  449.         'lrf'])
  450.     description = _('Set metadata in %s files') % 'LRF'
  451.     
  452.     def set_metadata(self, stream, mi, type):
  453.         set_metadata = set_metadata
  454.         import calibre.ebooks.lrf.meta
  455.         set_metadata(stream, mi)
  456.  
  457.  
  458.  
  459. class MOBIMetadataWriter(MetadataWriterPlugin):
  460.     name = 'Set MOBI metadata'
  461.     file_types = set([
  462.         'mobi',
  463.         'prc',
  464.         'azw'])
  465.     description = _('Set metadata in %s files') % 'MOBI'
  466.     author = 'Marshall T. Vandegrift'
  467.     
  468.     def set_metadata(self, stream, mi, type):
  469.         set_metadata = set_metadata
  470.         import calibre.ebooks.metadata.mobi
  471.         set_metadata(stream, mi)
  472.  
  473.  
  474.  
  475. class PDBMetadataWriter(MetadataWriterPlugin):
  476.     name = 'Set PDB metadata'
  477.     file_types = set([
  478.         'pdb'])
  479.     description = _('Set metadata from %s files') % 'PDB'
  480.     author = 'John Schember'
  481.     
  482.     def set_metadata(self, stream, mi, type):
  483.         set_metadata = set_metadata
  484.         import calibre.ebooks.metadata.pdb
  485.         set_metadata(stream, mi)
  486.  
  487.  
  488.  
  489. class PDFMetadataWriter(MetadataWriterPlugin):
  490.     name = 'Set PDF metadata'
  491.     file_types = set([
  492.         'pdf'])
  493.     description = _('Set metadata in %s files') % 'PDF'
  494.     author = 'Kovid Goyal'
  495.     
  496.     def set_metadata(self, stream, mi, type):
  497.         set_metadata = set_metadata
  498.         import calibre.ebooks.metadata.pdf
  499.         set_metadata(stream, mi)
  500.  
  501.  
  502.  
  503. class RTFMetadataWriter(MetadataWriterPlugin):
  504.     name = 'Set RTF metadata'
  505.     file_types = set([
  506.         'rtf'])
  507.     description = _('Set metadata in %s files') % 'RTF'
  508.     
  509.     def set_metadata(self, stream, mi, type):
  510.         set_metadata = set_metadata
  511.         import calibre.ebooks.metadata.rtf
  512.         set_metadata(stream, mi)
  513.  
  514.  
  515.  
  516. class TOPAZMetadataWriter(MetadataWriterPlugin):
  517.     name = 'Set TOPAZ metadata'
  518.     file_types = set([
  519.         'tpz',
  520.         'azw1'])
  521.     description = _('Set metadata in %s files') % 'TOPAZ'
  522.     author = 'Greg Riker'
  523.     
  524.     def set_metadata(self, stream, mi, type):
  525.         set_metadata = set_metadata
  526.         import calibre.ebooks.metadata.topaz
  527.         set_metadata(stream, mi)
  528.  
  529.  
  530. from calibre.ebooks.comic.input import ComicInput
  531. from calibre.ebooks.epub.input import EPUBInput
  532. from calibre.ebooks.fb2.input import FB2Input
  533. from calibre.ebooks.html.input import HTMLInput
  534. from calibre.ebooks.lit.input import LITInput
  535. from calibre.ebooks.mobi.input import MOBIInput
  536. from calibre.ebooks.odt.input import ODTInput
  537. from calibre.ebooks.pdb.input import PDBInput
  538. from calibre.ebooks.pdf.input import PDFInput
  539. from calibre.ebooks.pml.input import PMLInput
  540. from calibre.ebooks.rb.input import RBInput
  541. from calibre.web.feeds.input import RecipeInput
  542. from calibre.ebooks.rtf.input import RTFInput
  543. from calibre.ebooks.tcr.input import TCRInput
  544. from calibre.ebooks.txt.input import TXTInput
  545. from calibre.ebooks.lrf.input import LRFInput
  546. from calibre.ebooks.chm.input import CHMInput
  547. from calibre.ebooks.snb.input import SNBInput
  548. from calibre.ebooks.epub.output import EPUBOutput
  549. from calibre.ebooks.fb2.output import FB2Output
  550. from calibre.ebooks.lit.output import LITOutput
  551. from calibre.ebooks.lrf.output import LRFOutput
  552. from calibre.ebooks.mobi.output import MOBIOutput
  553. from calibre.ebooks.oeb.output import OEBOutput
  554. from calibre.ebooks.pdb.output import PDBOutput
  555. from calibre.ebooks.pdf.output import PDFOutput
  556. from calibre.ebooks.pml.output import PMLOutput
  557. from calibre.ebooks.rb.output import RBOutput
  558. from calibre.ebooks.rtf.output import RTFOutput
  559. from calibre.ebooks.tcr.output import TCROutput
  560. from calibre.ebooks.txt.output import TXTOutput
  561. from calibre.ebooks.snb.output import SNBOutput
  562. from calibre.customize.profiles import input_profiles, output_profiles
  563. from calibre.devices.apple.driver import ITUNES
  564. from calibre.devices.hanlin.driver import HANLINV3, HANLINV5, BOOX, SPECTRA
  565. from calibre.devices.blackberry.driver import BLACKBERRY
  566. from calibre.devices.cybook.driver import CYBOOK
  567. from calibre.devices.eb600.driver import EB600, COOL_ER, SHINEBOOK, POCKETBOOK360, GER2, ITALICA, ECLICTO, DBOOK, INVESBOOK, BOOQ, ELONEX, POCKETBOOK301, MENTOR
  568. from calibre.devices.iliad.driver import ILIAD
  569. from calibre.devices.irexdr.driver import IREXDR1000, IREXDR800
  570. from calibre.devices.jetbook.driver import JETBOOK, MIBUK, JETBOOK_MINI
  571. from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX
  572. from calibre.devices.nook.driver import NOOK
  573. from calibre.devices.prs505.driver import PRS505
  574. from calibre.devices.android.driver import ANDROID, S60
  575. from calibre.devices.nokia.driver import N770, N810, E71X, E52
  576. from calibre.devices.eslick.driver import ESLICK, EBK52
  577. from calibre.devices.nuut2.driver import NUUT2
  578. from calibre.devices.iriver.driver import IRIVER_STORY
  579. from calibre.devices.binatone.driver import README
  580. from calibre.devices.hanvon.driver import N516, EB511, ALEX, AZBOOKA, THEBOOK
  581. from calibre.devices.edge.driver import EDGE
  582. from calibre.devices.teclast.driver import TECLAST_K3, NEWSMY, IPAPYRUS, SOVOS, PICO
  583. from calibre.devices.sne.driver import SNE
  584. from calibre.devices.misc import PALMPRE, AVANT, SWEEX, PDNOVEL, KOGAN, GEMEI, VELOCITYMICRO, PDNOVEL_KOBO, Q600
  585. from calibre.devices.folder_device.driver import FOLDER_DEVICE_FOR_CONFIG
  586. from calibre.devices.kobo.driver import KOBO
  587. from calibre.ebooks.metadata.fetch import GoogleBooks, ISBNDB, Amazon, LibraryThing
  588. from calibre.ebooks.metadata.douban import DoubanBooks
  589. from calibre.ebooks.metadata.covers import OpenLibraryCovers, LibraryThingCovers, DoubanCovers
  590. from calibre.library.catalog import CSV_XML, EPUB_MOBI, BIBTEX
  591. from calibre.ebooks.epub.fix.unmanifested import Unmanifested
  592. from calibre.ebooks.epub.fix.epubcheck import Epubcheck
  593. plugins = [
  594.     HTML2ZIP,
  595.     PML2PMLZ,
  596.     ArchiveExtract,
  597.     GoogleBooks,
  598.     ISBNDB,
  599.     Amazon,
  600.     LibraryThing,
  601.     DoubanBooks,
  602.     CSV_XML,
  603.     EPUB_MOBI,
  604.     BIBTEX,
  605.     Unmanifested,
  606.     Epubcheck,
  607.     OpenLibraryCovers,
  608.     LibraryThingCovers,
  609.     DoubanCovers]
  610. plugins += [
  611.     ComicInput,
  612.     EPUBInput,
  613.     FB2Input,
  614.     HTMLInput,
  615.     LITInput,
  616.     MOBIInput,
  617.     ODTInput,
  618.     PDBInput,
  619.     PDFInput,
  620.     PMLInput,
  621.     RBInput,
  622.     RecipeInput,
  623.     RTFInput,
  624.     TCRInput,
  625.     TXTInput,
  626.     LRFInput,
  627.     CHMInput,
  628.     SNBInput]
  629. plugins += [
  630.     EPUBOutput,
  631.     FB2Output,
  632.     LITOutput,
  633.     LRFOutput,
  634.     MOBIOutput,
  635.     OEBOutput,
  636.     PDBOutput,
  637.     PDFOutput,
  638.     PMLOutput,
  639.     RBOutput,
  640.     RTFOutput,
  641.     TCROutput,
  642.     TXTOutput,
  643.     SNBOutput]
  644. plugins += [
  645.     HANLINV3,
  646.     HANLINV5,
  647.     BLACKBERRY,
  648.     CYBOOK,
  649.     ILIAD,
  650.     IREXDR1000,
  651.     IREXDR800,
  652.     JETBOOK,
  653.     JETBOOK_MINI,
  654.     MIBUK,
  655.     SHINEBOOK,
  656.     POCKETBOOK360,
  657.     POCKETBOOK301,
  658.     KINDLE,
  659.     KINDLE2,
  660.     KINDLE_DX,
  661.     NOOK,
  662.     PRS505,
  663.     ANDROID,
  664.     S60,
  665.     N770,
  666.     E71X,
  667.     E52,
  668.     N810,
  669.     COOL_ER,
  670.     ESLICK,
  671.     EBK52,
  672.     NUUT2,
  673.     IRIVER_STORY,
  674.     GER2,
  675.     ITALICA,
  676.     ECLICTO,
  677.     DBOOK,
  678.     INVESBOOK,
  679.     BOOX,
  680.     BOOQ,
  681.     EB600,
  682.     README,
  683.     N516,
  684.     THEBOOK,
  685.     EB511,
  686.     ELONEX,
  687.     TECLAST_K3,
  688.     NEWSMY,
  689.     PICO,
  690.     IPAPYRUS,
  691.     SOVOS,
  692.     EDGE,
  693.     SNE,
  694.     ALEX,
  695.     PALMPRE,
  696.     KOBO,
  697.     AZBOOKA,
  698.     FOLDER_DEVICE_FOR_CONFIG,
  699.     AVANT,
  700.     MENTOR,
  701.     SWEEX,
  702.     Q600,
  703.     KOGAN,
  704.     PDNOVEL,
  705.     SPECTRA,
  706.     GEMEI,
  707.     VELOCITYMICRO,
  708.     PDNOVEL_KOBO,
  709.     ITUNES]
  710. [] += _[1]
  711. [] += _[2]
  712. plugins += input_profiles + output_profiles
  713.  
  714. class ActionAdd(InterfaceActionBase):
  715.     name = 'Add Books'
  716.     actual_plugin = 'calibre.gui2.actions.add:AddAction'
  717.  
  718.  
  719. class ActionFetchAnnotations(InterfaceActionBase):
  720.     name = 'Fetch Annotations'
  721.     actual_plugin = 'calibre.gui2.actions.annotate:FetchAnnotationsAction'
  722.  
  723.  
  724. class ActionGenerateCatalog(InterfaceActionBase):
  725.     name = 'Generate Catalog'
  726.     actual_plugin = 'calibre.gui2.actions.catalog:GenerateCatalogAction'
  727.  
  728.  
  729. class ActionConvert(InterfaceActionBase):
  730.     name = 'Convert Books'
  731.     actual_plugin = 'calibre.gui2.actions.convert:ConvertAction'
  732.  
  733.  
  734. class ActionDelete(InterfaceActionBase):
  735.     name = 'Remove Books'
  736.     actual_plugin = 'calibre.gui2.actions.delete:DeleteAction'
  737.  
  738.  
  739. class ActionEditMetadata(InterfaceActionBase):
  740.     name = 'Edit Metadata'
  741.     actual_plugin = 'calibre.gui2.actions.edit_metadata:EditMetadataAction'
  742.  
  743.  
  744. class ActionView(InterfaceActionBase):
  745.     name = 'View'
  746.     actual_plugin = 'calibre.gui2.actions.view:ViewAction'
  747.  
  748.  
  749. class ActionFetchNews(InterfaceActionBase):
  750.     name = 'Fetch News'
  751.     actual_plugin = 'calibre.gui2.actions.fetch_news:FetchNewsAction'
  752.  
  753.  
  754. class ActionSaveToDisk(InterfaceActionBase):
  755.     name = 'Save To Disk'
  756.     actual_plugin = 'calibre.gui2.actions.save_to_disk:SaveToDiskAction'
  757.  
  758.  
  759. class ActionShowBookDetails(InterfaceActionBase):
  760.     name = 'Show Book Details'
  761.     actual_plugin = 'calibre.gui2.actions.show_book_details:ShowBookDetailsAction'
  762.  
  763.  
  764. class ActionRestart(InterfaceActionBase):
  765.     name = 'Restart'
  766.     actual_plugin = 'calibre.gui2.actions.restart:RestartAction'
  767.  
  768.  
  769. class ActionOpenFolder(InterfaceActionBase):
  770.     name = 'Open Folder'
  771.     actual_plugin = 'calibre.gui2.actions.open:OpenFolderAction'
  772.  
  773.  
  774. class ActionSendToDevice(InterfaceActionBase):
  775.     name = 'Send To Device'
  776.     actual_plugin = 'calibre.gui2.actions.device:SendToDeviceAction'
  777.  
  778.  
  779. class ActionConnectShare(InterfaceActionBase):
  780.     name = 'Connect Share'
  781.     actual_plugin = 'calibre.gui2.actions.device:ConnectShareAction'
  782.  
  783.  
  784. class ActionHelp(InterfaceActionBase):
  785.     name = 'Help'
  786.     actual_plugin = 'calibre.gui2.actions.help:HelpAction'
  787.  
  788.  
  789. class ActionPreferences(InterfaceActionBase):
  790.     name = 'Preferences'
  791.     actual_plugin = 'calibre.gui2.actions.preferences:PreferencesAction'
  792.  
  793.  
  794. class ActionSimilarBooks(InterfaceActionBase):
  795.     name = 'Similar Books'
  796.     actual_plugin = 'calibre.gui2.actions.similar_books:SimilarBooksAction'
  797.  
  798.  
  799. class ActionChooseLibrary(InterfaceActionBase):
  800.     name = 'Choose Library'
  801.     actual_plugin = 'calibre.gui2.actions.choose_library:ChooseLibraryAction'
  802.  
  803.  
  804. class ActionAddToLibrary(InterfaceActionBase):
  805.     name = 'Add To Library'
  806.     actual_plugin = 'calibre.gui2.actions.add_to_library:AddToLibraryAction'
  807.  
  808.  
  809. class ActionEditCollections(InterfaceActionBase):
  810.     name = 'Edit Collections'
  811.     actual_plugin = 'calibre.gui2.actions.edit_collections:EditCollectionsAction'
  812.  
  813.  
  814. class ActionCopyToLibrary(InterfaceActionBase):
  815.     name = 'Copy To Library'
  816.     actual_plugin = 'calibre.gui2.actions.copy_to_library:CopyToLibraryAction'
  817.  
  818.  
  819. class ActionTweakEpub(InterfaceActionBase):
  820.     name = 'Tweak ePub'
  821.     actual_plugin = 'calibre.gui2.actions.tweak_epub:TweakEpubAction'
  822.  
  823. plugins += [
  824.     ActionAdd,
  825.     ActionFetchAnnotations,
  826.     ActionGenerateCatalog,
  827.     ActionConvert,
  828.     ActionDelete,
  829.     ActionEditMetadata,
  830.     ActionView,
  831.     ActionFetchNews,
  832.     ActionSaveToDisk,
  833.     ActionShowBookDetails,
  834.     ActionRestart,
  835.     ActionOpenFolder,
  836.     ActionConnectShare,
  837.     ActionSendToDevice,
  838.     ActionHelp,
  839.     ActionPreferences,
  840.     ActionSimilarBooks,
  841.     ActionAddToLibrary,
  842.     ActionEditCollections,
  843.     ActionChooseLibrary,
  844.     ActionCopyToLibrary,
  845.     ActionTweakEpub]
  846.  
  847. class LookAndFeel(PreferencesPlugin):
  848.     name = 'Look & Feel'
  849.     icon = I('lookfeel.png')
  850.     gui_name = _('Look and Feel')
  851.     category = 'Interface'
  852.     gui_category = _('Interface')
  853.     category_order = 1
  854.     name_order = 1
  855.     config_widget = 'calibre.gui2.preferences.look_feel'
  856.     description = _('Adjust the look and feel of the calibre interface to suit your tastes')
  857.  
  858.  
  859. class Behavior(PreferencesPlugin):
  860.     name = 'Behavior'
  861.     icon = I('config.png')
  862.     gui_name = _('Behavior')
  863.     category = 'Interface'
  864.     gui_category = _('Interface')
  865.     category_order = 1
  866.     name_order = 2
  867.     config_widget = 'calibre.gui2.preferences.behavior'
  868.     description = _('Change the way calibre behaves')
  869.  
  870.  
  871. class Columns(PreferencesPlugin):
  872.     name = 'Custom Columns'
  873.     icon = I('column.png')
  874.     gui_name = _('Add your own columns')
  875.     category = 'Interface'
  876.     gui_category = _('Interface')
  877.     category_order = 1
  878.     name_order = 3
  879.     config_widget = 'calibre.gui2.preferences.columns'
  880.     description = _('Add/remove your own columns to the calibre book list')
  881.  
  882.  
  883. class Toolbar(PreferencesPlugin):
  884.     name = 'Toolbar'
  885.     icon = I('wizard.png')
  886.     gui_name = _('Customize the toolbar')
  887.     category = 'Interface'
  888.     gui_category = _('Interface')
  889.     category_order = 1
  890.     name_order = 4
  891.     config_widget = 'calibre.gui2.preferences.toolbar'
  892.     description = _('Customize the toolbars and context menus, changing which actions are available in each')
  893.  
  894.  
  895. class InputOptions(PreferencesPlugin):
  896.     name = 'Input Options'
  897.     icon = I('arrow-down.png')
  898.     gui_name = _('Input Options')
  899.     category = 'Conversion'
  900.     gui_category = _('Conversion')
  901.     category_order = 2
  902.     name_order = 1
  903.     config_widget = 'calibre.gui2.preferences.conversion:InputOptions'
  904.     description = _('Set conversion options specific to each input format')
  905.  
  906.  
  907. class CommonOptions(PreferencesPlugin):
  908.     name = 'Common Options'
  909.     icon = I('convert.png')
  910.     gui_name = _('Common Options')
  911.     category = 'Conversion'
  912.     gui_category = _('Conversion')
  913.     category_order = 2
  914.     name_order = 2
  915.     config_widget = 'calibre.gui2.preferences.conversion:CommonOptions'
  916.     description = _('Set conversion options common to all formats')
  917.  
  918.  
  919. class OutputOptions(PreferencesPlugin):
  920.     name = 'Output Options'
  921.     icon = I('arrow-up.png')
  922.     gui_name = _('Output Options')
  923.     category = 'Conversion'
  924.     gui_category = _('Conversion')
  925.     category_order = 2
  926.     name_order = 3
  927.     config_widget = 'calibre.gui2.preferences.conversion:OutputOptions'
  928.     description = _('Set conversion options specific to each output format')
  929.  
  930.  
  931. class Adding(PreferencesPlugin):
  932.     name = 'Adding'
  933.     icon = I('add_book.png')
  934.     gui_name = _('Adding books')
  935.     category = 'Import/Export'
  936.     gui_category = _('Import/Export')
  937.     category_order = 3
  938.     name_order = 1
  939.     config_widget = 'calibre.gui2.preferences.adding'
  940.     description = _('Control how calibre reads metadata from files when adding books')
  941.  
  942.  
  943. class Saving(PreferencesPlugin):
  944.     name = 'Saving'
  945.     icon = I('save.png')
  946.     gui_name = _('Saving books to disk')
  947.     category = 'Import/Export'
  948.     gui_category = _('Import/Export')
  949.     category_order = 3
  950.     name_order = 2
  951.     config_widget = 'calibre.gui2.preferences.saving'
  952.     description = _('Control how calibre exports files from its database to disk when using Save to disk')
  953.  
  954.  
  955. class Sending(PreferencesPlugin):
  956.     name = 'Sending'
  957.     icon = I('sync.png')
  958.     gui_name = _('Sending books to devices')
  959.     category = 'Import/Export'
  960.     gui_category = _('Import/Export')
  961.     category_order = 3
  962.     name_order = 3
  963.     config_widget = 'calibre.gui2.preferences.sending'
  964.     description = _('Control how calibre transfers files to your ebook reader')
  965.  
  966.  
  967. class Plugboard(PreferencesPlugin):
  968.     name = 'Plugboard'
  969.     icon = I('plugboard.png')
  970.     gui_name = _('Metadata plugboards')
  971.     category = 'Import/Export'
  972.     gui_category = _('Import/Export')
  973.     category_order = 3
  974.     name_order = 4
  975.     config_widget = 'calibre.gui2.preferences.plugboard'
  976.     description = _('Change metadata fields before saving/sending')
  977.  
  978.  
  979. class Email(PreferencesPlugin):
  980.     name = 'Email'
  981.     icon = I('mail.png')
  982.     gui_name = _('Sharing books by email')
  983.     category = 'Sharing'
  984.     gui_category = _('Sharing')
  985.     category_order = 4
  986.     name_order = 1
  987.     config_widget = 'calibre.gui2.preferences.emailp'
  988.     description = _('Setup sharing of books via email. Can be used for automatic sending of downloaded news to your devices')
  989.  
  990.  
  991. class Server(PreferencesPlugin):
  992.     name = 'Server'
  993.     icon = I('network-server.png')
  994.     gui_name = _('Sharing over the net')
  995.     category = 'Sharing'
  996.     gui_category = _('Sharing')
  997.     category_order = 4
  998.     name_order = 2
  999.     config_widget = 'calibre.gui2.preferences.server'
  1000.     description = _('Setup the calibre Content Server which will give you access to your calibre library from anywhere, on any device, over the internet')
  1001.  
  1002.  
  1003. class Plugins(PreferencesPlugin):
  1004.     name = 'Plugins'
  1005.     icon = I('plugins.png')
  1006.     gui_name = _('Plugins')
  1007.     category = 'Advanced'
  1008.     gui_category = _('Advanced')
  1009.     category_order = 5
  1010.     name_order = 1
  1011.     config_widget = 'calibre.gui2.preferences.plugins'
  1012.     description = _('Add/remove/customize various bits of calibre functionality')
  1013.  
  1014.  
  1015. class Tweaks(PreferencesPlugin):
  1016.     name = 'Tweaks'
  1017.     icon = I('drawer.png')
  1018.     gui_name = _('Tweaks')
  1019.     category = 'Advanced'
  1020.     gui_category = _('Advanced')
  1021.     category_order = 5
  1022.     name_order = 2
  1023.     config_widget = 'calibre.gui2.preferences.tweaks'
  1024.     description = _('Fine tune how calibre behaves in various contexts')
  1025.  
  1026.  
  1027. class Misc(PreferencesPlugin):
  1028.     name = 'Misc'
  1029.     icon = I('exec.png')
  1030.     gui_name = _('Miscellaneous')
  1031.     category = 'Advanced'
  1032.     gui_category = _('Advanced')
  1033.     category_order = 5
  1034.     name_order = 3
  1035.     config_widget = 'calibre.gui2.preferences.misc'
  1036.     description = _('Miscellaneous advanced configuration')
  1037.  
  1038. plugins += [
  1039.     LookAndFeel,
  1040.     Behavior,
  1041.     Columns,
  1042.     Toolbar,
  1043.     InputOptions,
  1044.     CommonOptions,
  1045.     OutputOptions,
  1046.     Adding,
  1047.     Saving,
  1048.     Sending,
  1049.     Plugboard,
  1050.     Email,
  1051.     Server,
  1052.     Plugins,
  1053.     Tweaks,
  1054.     Misc]
  1055.