1# -*- coding: utf-8 -*-
2
3
4__license__   = 'GPL v3'
5__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
6
7import os, glob
8from calibre.customize import (FileTypePlugin, MetadataReaderPlugin,
9    MetadataWriterPlugin, PreferencesPlugin, InterfaceActionBase, StoreBase)
10from calibre.constants import numeric_version
11from calibre.ebooks.metadata.archive import ArchiveExtract, KPFExtract, get_comic_metadata
12from calibre.ebooks.html.to_zip import HTML2ZIP
13
14plugins = []
15
16# To archive plugins {{{
17
18
19class PML2PMLZ(FileTypePlugin):
20    name = 'PML to PMLZ'
21    author = 'John Schember'
22    description = _('Create a PMLZ archive containing the PML file '
23        'and all images in the folder pmlname_img or images. '
24        'This plugin is run every time you add '
25        'a PML file to the library.')
26    version = numeric_version
27    file_types = {'pml'}
28    supported_platforms = ['windows', 'osx', 'linux']
29    on_import = True
30
31    def run(self, pmlfile):
32        import zipfile
33
34        of = self.temporary_file('_plugin_pml2pmlz.pmlz')
35        pmlz = zipfile.ZipFile(of.name, 'w')
36        pmlz.write(pmlfile, os.path.basename(pmlfile), zipfile.ZIP_DEFLATED)
37
38        pml_img = os.path.splitext(pmlfile)[0] + '_img'
39        i_img = os.path.join(os.path.dirname(pmlfile),'images')
40        img_dir = pml_img if os.path.isdir(pml_img) else i_img if \
41            os.path.isdir(i_img) else ''
42        if img_dir:
43            for image in glob.glob(os.path.join(img_dir, '*.png')):
44                pmlz.write(image, os.path.join('images', (os.path.basename(image))))
45        pmlz.close()
46
47        return of.name
48
49
50class TXT2TXTZ(FileTypePlugin):
51    name = 'TXT to TXTZ'
52    author = 'John Schember'
53    description = _('Create a TXTZ archive when a TXT file is imported '
54        'containing Markdown or Textile references to images. The referenced '
55        'images as well as the TXT file are added to the archive.')
56    version = numeric_version
57    file_types = {'txt', 'text', 'md', 'markdown', 'textile'}
58    supported_platforms = ['windows', 'osx', 'linux']
59    on_import = True
60
61    def run(self, path_to_ebook):
62        from calibre.ebooks.metadata.opf2 import metadata_to_opf
63        from calibre.ebooks.txt.processor import get_images_from_polyglot_text
64
65        with open(path_to_ebook, 'rb') as ebf:
66            txt = ebf.read().decode('utf-8', 'replace')
67        base_dir = os.path.dirname(path_to_ebook)
68        ext = path_to_ebook.rpartition('.')[-1].lower()
69        images = get_images_from_polyglot_text(txt, base_dir, ext)
70
71        if images:
72            # Create TXTZ and put file plus images inside of it.
73            import zipfile
74            of = self.temporary_file('_plugin_txt2txtz.txtz')
75            txtz = zipfile.ZipFile(of.name, 'w')
76            # Add selected TXT file to archive.
77            txtz.write(path_to_ebook, os.path.basename(path_to_ebook), zipfile.ZIP_DEFLATED)
78            # metadata.opf
79            if os.path.exists(os.path.join(base_dir, 'metadata.opf')):
80                txtz.write(os.path.join(base_dir, 'metadata.opf'), 'metadata.opf', zipfile.ZIP_DEFLATED)
81            else:
82                from calibre.ebooks.metadata.txt import get_metadata
83                with open(path_to_ebook, 'rb') as ebf:
84                    mi = get_metadata(ebf)
85                opf = metadata_to_opf(mi)
86                txtz.writestr('metadata.opf', opf, zipfile.ZIP_DEFLATED)
87            # images
88            for image in images:
89                txtz.write(os.path.join(base_dir, image), image)
90            txtz.close()
91
92            return of.name
93        else:
94            # No images so just import the TXT file.
95            return path_to_ebook
96
97
98plugins += [HTML2ZIP, PML2PMLZ, TXT2TXTZ, ArchiveExtract, KPFExtract]
99# }}}
100
101# Metadata reader plugins {{{
102
103
104class ComicMetadataReader(MetadataReaderPlugin):
105
106    name = 'Read comic metadata'
107    file_types = {'cbr', 'cbz', 'cb7'}
108    description = _('Extract cover from comic files')
109
110    def customization_help(self, gui=False):
111        return 'Read series number from volume or issue number. Default is volume, set this to issue to use issue number instead.'
112
113    def get_metadata(self, stream, ftype):
114        if hasattr(stream, 'seek') and hasattr(stream, 'tell'):
115            pos = stream.tell()
116            id_ = stream.read(3)
117            stream.seek(pos)
118            if id_ == b'Rar':
119                ftype = 'cbr'
120            elif id_.startswith(b'PK'):
121                ftype = 'cbz'
122            elif id_.startswith(b'7z'):
123                ftype = 'cb7'
124        if ftype == 'cbr':
125            from calibre.utils.unrar import extract_cover_image
126        elif ftype == 'cb7':
127            from calibre.utils.seven_zip import extract_cover_image
128        else:
129            from calibre.libunzip import extract_cover_image
130        from calibre.ebooks.metadata import MetaInformation
131        ret = extract_cover_image(stream)
132        mi = MetaInformation(None, None)
133        stream.seek(0)
134        if ftype in {'cbr', 'cbz'}:
135            series_index = self.site_customization
136            if series_index not in {'volume', 'issue'}:
137                series_index = 'volume'
138            try:
139                mi.smart_update(get_comic_metadata(stream, ftype, series_index=series_index))
140            except:
141                pass
142        if ret is not None:
143            path, data = ret
144            ext = os.path.splitext(path)[1][1:]
145            mi.cover_data = (ext.lower(), data)
146        return mi
147
148
149class CHMMetadataReader(MetadataReaderPlugin):
150
151    name        = 'Read CHM metadata'
152    file_types  = {'chm'}
153    description = _('Read metadata from %s files') % 'CHM'
154
155    def get_metadata(self, stream, ftype):
156        from calibre.ebooks.chm.metadata import get_metadata
157        return get_metadata(stream)
158
159
160class EPUBMetadataReader(MetadataReaderPlugin):
161
162    name        = 'Read EPUB metadata'
163    file_types  = {'epub'}
164    description = _('Read metadata from %s files')%'EPUB'
165
166    def get_metadata(self, stream, ftype):
167        from calibre.ebooks.metadata.epub import get_metadata, get_quick_metadata
168        if self.quick:
169            return get_quick_metadata(stream)
170        return get_metadata(stream)
171
172
173class FB2MetadataReader(MetadataReaderPlugin):
174
175    name        = 'Read FB2 metadata'
176    file_types  = {'fb2', 'fbz'}
177    description = _('Read metadata from %s files')%'FB2'
178
179    def get_metadata(self, stream, ftype):
180        from calibre.ebooks.metadata.fb2 import get_metadata
181        return get_metadata(stream)
182
183
184class HTMLMetadataReader(MetadataReaderPlugin):
185
186    name        = 'Read HTML metadata'
187    file_types  = {'html'}
188    description = _('Read metadata from %s files')%'HTML'
189
190    def get_metadata(self, stream, ftype):
191        from calibre.ebooks.metadata.html import get_metadata
192        return get_metadata(stream)
193
194
195class HTMLZMetadataReader(MetadataReaderPlugin):
196
197    name        = 'Read HTMLZ metadata'
198    file_types  = {'htmlz'}
199    description = _('Read metadata from %s files') % 'HTMLZ'
200    author      = 'John Schember'
201
202    def get_metadata(self, stream, ftype):
203        from calibre.ebooks.metadata.extz import get_metadata
204        return get_metadata(stream)
205
206
207class IMPMetadataReader(MetadataReaderPlugin):
208
209    name        = 'Read IMP metadata'
210    file_types  = {'imp'}
211    description = _('Read metadata from %s files')%'IMP'
212    author      = 'Ashish Kulkarni'
213
214    def get_metadata(self, stream, ftype):
215        from calibre.ebooks.metadata.imp import get_metadata
216        return get_metadata(stream)
217
218
219class LITMetadataReader(MetadataReaderPlugin):
220
221    name        = 'Read LIT metadata'
222    file_types  = {'lit'}
223    description = _('Read metadata from %s files')%'LIT'
224
225    def get_metadata(self, stream, ftype):
226        from calibre.ebooks.metadata.lit import get_metadata
227        return get_metadata(stream)
228
229
230class LRFMetadataReader(MetadataReaderPlugin):
231
232    name        = 'Read LRF metadata'
233    file_types  = {'lrf'}
234    description = _('Read metadata from %s files')%'LRF'
235
236    def get_metadata(self, stream, ftype):
237        from calibre.ebooks.lrf.meta import get_metadata
238        return get_metadata(stream)
239
240
241class LRXMetadataReader(MetadataReaderPlugin):
242
243    name        = 'Read LRX metadata'
244    file_types  = {'lrx'}
245    description = _('Read metadata from %s files')%'LRX'
246
247    def get_metadata(self, stream, ftype):
248        from calibre.ebooks.metadata.lrx import get_metadata
249        return get_metadata(stream)
250
251
252class MOBIMetadataReader(MetadataReaderPlugin):
253
254    name        = 'Read MOBI metadata'
255    file_types  = {'mobi', 'prc', 'azw', 'azw3', 'azw4', 'pobi'}
256    description = _('Read metadata from %s files')%'MOBI'
257
258    def get_metadata(self, stream, ftype):
259        from calibre.ebooks.metadata.mobi import get_metadata
260        return get_metadata(stream)
261
262
263class ODTMetadataReader(MetadataReaderPlugin):
264
265    name        = 'Read ODT metadata'
266    file_types  = {'odt'}
267    description = _('Read metadata from %s files')%'ODT'
268
269    def get_metadata(self, stream, ftype):
270        from calibre.ebooks.metadata.odt import get_metadata
271        return get_metadata(stream)
272
273
274class DocXMetadataReader(MetadataReaderPlugin):
275
276    name        = 'Read DOCX metadata'
277    file_types  = {'docx'}
278    description = _('Read metadata from %s files')%'DOCX'
279
280    def get_metadata(self, stream, ftype):
281        from calibre.ebooks.metadata.docx import get_metadata
282        return get_metadata(stream)
283
284
285class OPFMetadataReader(MetadataReaderPlugin):
286
287    name        = 'Read OPF metadata'
288    file_types  = {'opf'}
289    description = _('Read metadata from %s files')%'OPF'
290
291    def get_metadata(self, stream, ftype):
292        from calibre.ebooks.metadata.opf import get_metadata
293        return get_metadata(stream)[0]
294
295
296class PDBMetadataReader(MetadataReaderPlugin):
297
298    name        = 'Read PDB metadata'
299    file_types  = {'pdb', 'updb'}
300    description = _('Read metadata from %s files') % 'PDB'
301    author      = 'John Schember'
302
303    def get_metadata(self, stream, ftype):
304        from calibre.ebooks.metadata.pdb import get_metadata
305        return get_metadata(stream)
306
307
308class PDFMetadataReader(MetadataReaderPlugin):
309
310    name        = 'Read PDF metadata'
311    file_types  = {'pdf'}
312    description = _('Read metadata from %s files')%'PDF'
313
314    def get_metadata(self, stream, ftype):
315        from calibre.ebooks.metadata.pdf import get_metadata, get_quick_metadata
316        if self.quick:
317            return get_quick_metadata(stream)
318        return get_metadata(stream)
319
320
321class PMLMetadataReader(MetadataReaderPlugin):
322
323    name        = 'Read PML metadata'
324    file_types  = {'pml', 'pmlz'}
325    description = _('Read metadata from %s files') % 'PML'
326    author      = 'John Schember'
327
328    def get_metadata(self, stream, ftype):
329        from calibre.ebooks.metadata.pml import get_metadata
330        return get_metadata(stream)
331
332
333class RARMetadataReader(MetadataReaderPlugin):
334
335    name = 'Read RAR metadata'
336    file_types = {'rar'}
337    description = _('Read metadata from e-books in RAR archives')
338
339    def get_metadata(self, stream, ftype):
340        from calibre.ebooks.metadata.rar import get_metadata
341        return get_metadata(stream)
342
343
344class RBMetadataReader(MetadataReaderPlugin):
345
346    name        = 'Read RB metadata'
347    file_types  = {'rb'}
348    description = _('Read metadata from %s files')%'RB'
349    author      = 'Ashish Kulkarni'
350
351    def get_metadata(self, stream, ftype):
352        from calibre.ebooks.metadata.rb import get_metadata
353        return get_metadata(stream)
354
355
356class RTFMetadataReader(MetadataReaderPlugin):
357
358    name        = 'Read RTF metadata'
359    file_types  = {'rtf'}
360    description = _('Read metadata from %s files')%'RTF'
361
362    def get_metadata(self, stream, ftype):
363        from calibre.ebooks.metadata.rtf import get_metadata
364        return get_metadata(stream)
365
366
367class SNBMetadataReader(MetadataReaderPlugin):
368
369    name        = 'Read SNB metadata'
370    file_types  = {'snb'}
371    description = _('Read metadata from %s files') % 'SNB'
372    author      = 'Li Fanxi'
373
374    def get_metadata(self, stream, ftype):
375        from calibre.ebooks.metadata.snb import get_metadata
376        return get_metadata(stream)
377
378
379class TOPAZMetadataReader(MetadataReaderPlugin):
380
381    name        = 'Read Topaz metadata'
382    file_types  = {'tpz', 'azw1'}
383    description = _('Read metadata from %s files')%'MOBI'
384
385    def get_metadata(self, stream, ftype):
386        from calibre.ebooks.metadata.topaz import get_metadata
387        return get_metadata(stream)
388
389
390class TXTMetadataReader(MetadataReaderPlugin):
391
392    name        = 'Read TXT metadata'
393    file_types  = {'txt'}
394    description = _('Read metadata from %s files') % 'TXT'
395    author      = 'John Schember'
396
397    def get_metadata(self, stream, ftype):
398        from calibre.ebooks.metadata.txt import get_metadata
399        return get_metadata(stream)
400
401
402class TXTZMetadataReader(MetadataReaderPlugin):
403
404    name        = 'Read TXTZ metadata'
405    file_types  = {'txtz'}
406    description = _('Read metadata from %s files') % 'TXTZ'
407    author      = 'John Schember'
408
409    def get_metadata(self, stream, ftype):
410        from calibre.ebooks.metadata.extz import get_metadata
411        return get_metadata(stream)
412
413
414class ZipMetadataReader(MetadataReaderPlugin):
415
416    name = 'Read ZIP metadata'
417    file_types = {'zip', 'oebzip'}
418    description = _('Read metadata from e-books in ZIP archives')
419
420    def get_metadata(self, stream, ftype):
421        from calibre.ebooks.metadata.zip import get_metadata
422        return get_metadata(stream)
423
424
425plugins += [x for x in list(locals().values()) if isinstance(x, type) and
426                                        x.__name__.endswith('MetadataReader')]
427
428# }}}
429
430# Metadata writer plugins {{{
431
432
433class EPUBMetadataWriter(MetadataWriterPlugin):
434
435    name = 'Set EPUB metadata'
436    file_types = {'epub'}
437    description = _('Set metadata in %s files')%'EPUB'
438
439    def set_metadata(self, stream, mi, type):
440        from calibre.ebooks.metadata.epub import set_metadata
441        q = self.site_customization or ''
442        set_metadata(stream, mi, apply_null=self.apply_null, force_identifiers=self.force_identifiers, add_missing_cover='disable-add-missing-cover' != q)
443
444    def customization_help(self, gui=False):
445        h = 'disable-add-missing-cover'
446        if gui:
447            h = '<i>' + h + '</i>'
448        return _('Enter {0} below to have the EPUB metadata writer plugin not'
449                 ' add cover images to EPUB files that have no existing cover image.').format(h)
450
451
452class FB2MetadataWriter(MetadataWriterPlugin):
453
454    name = 'Set FB2 metadata'
455    file_types = {'fb2', 'fbz'}
456    description = _('Set metadata in %s files')%'FB2'
457
458    def set_metadata(self, stream, mi, type):
459        from calibre.ebooks.metadata.fb2 import set_metadata
460        set_metadata(stream, mi, apply_null=self.apply_null)
461
462
463class HTMLZMetadataWriter(MetadataWriterPlugin):
464
465    name        = 'Set HTMLZ metadata'
466    file_types  = {'htmlz'}
467    description = _('Set metadata from %s files') % 'HTMLZ'
468    author      = 'John Schember'
469
470    def set_metadata(self, stream, mi, type):
471        from calibre.ebooks.metadata.extz import set_metadata
472        set_metadata(stream, mi)
473
474
475class LRFMetadataWriter(MetadataWriterPlugin):
476
477    name = 'Set LRF metadata'
478    file_types = {'lrf'}
479    description = _('Set metadata in %s files')%'LRF'
480
481    def set_metadata(self, stream, mi, type):
482        from calibre.ebooks.lrf.meta import set_metadata
483        set_metadata(stream, mi)
484
485
486class MOBIMetadataWriter(MetadataWriterPlugin):
487
488    name        = 'Set MOBI metadata'
489    file_types  = {'mobi', 'prc', 'azw', 'azw3', 'azw4'}
490    description = _('Set metadata in %s files')%'MOBI'
491    author      = 'Marshall T. Vandegrift'
492
493    def set_metadata(self, stream, mi, type):
494        from calibre.ebooks.metadata.mobi import set_metadata
495        set_metadata(stream, mi)
496
497
498class PDBMetadataWriter(MetadataWriterPlugin):
499
500    name        = 'Set PDB metadata'
501    file_types  = {'pdb'}
502    description = _('Set metadata from %s files') % 'PDB'
503    author      = 'John Schember'
504
505    def set_metadata(self, stream, mi, type):
506        from calibre.ebooks.metadata.pdb import set_metadata
507        set_metadata(stream, mi)
508
509
510class PDFMetadataWriter(MetadataWriterPlugin):
511
512    name        = 'Set PDF metadata'
513    file_types  = {'pdf'}
514    description = _('Set metadata in %s files') % 'PDF'
515    author      = 'Kovid Goyal'
516
517    def set_metadata(self, stream, mi, type):
518        from calibre.ebooks.metadata.pdf import set_metadata
519        set_metadata(stream, mi)
520
521
522class RTFMetadataWriter(MetadataWriterPlugin):
523
524    name = 'Set RTF metadata'
525    file_types = {'rtf'}
526    description = _('Set metadata in %s files')%'RTF'
527
528    def set_metadata(self, stream, mi, type):
529        from calibre.ebooks.metadata.rtf import set_metadata
530        set_metadata(stream, mi)
531
532
533class TOPAZMetadataWriter(MetadataWriterPlugin):
534
535    name        = 'Set TOPAZ metadata'
536    file_types  = {'tpz', 'azw1'}
537    description = _('Set metadata in %s files')%'TOPAZ'
538    author      = 'Greg Riker'
539
540    def set_metadata(self, stream, mi, type):
541        from calibre.ebooks.metadata.topaz import set_metadata
542        set_metadata(stream, mi)
543
544
545class TXTZMetadataWriter(MetadataWriterPlugin):
546
547    name        = 'Set TXTZ metadata'
548    file_types  = {'txtz'}
549    description = _('Set metadata from %s files') % 'TXTZ'
550    author      = 'John Schember'
551
552    def set_metadata(self, stream, mi, type):
553        from calibre.ebooks.metadata.extz import set_metadata
554        set_metadata(stream, mi)
555
556
557class ODTMetadataWriter(MetadataWriterPlugin):
558
559    name        = 'Set ODT metadata'
560    file_types  = {'odt'}
561    description = _('Set metadata from %s files')%'ODT'
562
563    def set_metadata(self, stream, mi, type):
564        from calibre.ebooks.metadata.odt import set_metadata
565        return set_metadata(stream, mi)
566
567
568class DocXMetadataWriter(MetadataWriterPlugin):
569
570    name        = 'Set DOCX metadata'
571    file_types  = {'docx'}
572    description = _('Set metadata from %s files')%'DOCX'
573
574    def set_metadata(self, stream, mi, type):
575        from calibre.ebooks.metadata.docx import set_metadata
576        return set_metadata(stream, mi)
577
578
579plugins += [x for x in list(locals().values()) if isinstance(x, type) and
580                                        x.__name__.endswith('MetadataWriter')]
581
582# }}}
583
584# Conversion plugins {{{
585from calibre.ebooks.conversion.plugins.comic_input import ComicInput
586from calibre.ebooks.conversion.plugins.djvu_input import DJVUInput
587from calibre.ebooks.conversion.plugins.epub_input import EPUBInput
588from calibre.ebooks.conversion.plugins.fb2_input import FB2Input
589from calibre.ebooks.conversion.plugins.html_input import HTMLInput
590from calibre.ebooks.conversion.plugins.htmlz_input import HTMLZInput
591from calibre.ebooks.conversion.plugins.lit_input import LITInput
592from calibre.ebooks.conversion.plugins.mobi_input import MOBIInput
593from calibre.ebooks.conversion.plugins.odt_input import ODTInput
594from calibre.ebooks.conversion.plugins.pdb_input import PDBInput
595from calibre.ebooks.conversion.plugins.azw4_input import AZW4Input
596from calibre.ebooks.conversion.plugins.pdf_input import PDFInput
597from calibre.ebooks.conversion.plugins.pml_input import PMLInput
598from calibre.ebooks.conversion.plugins.rb_input import RBInput
599from calibre.ebooks.conversion.plugins.recipe_input import RecipeInput
600from calibre.ebooks.conversion.plugins.rtf_input import RTFInput
601from calibre.ebooks.conversion.plugins.tcr_input import TCRInput
602from calibre.ebooks.conversion.plugins.txt_input import TXTInput
603from calibre.ebooks.conversion.plugins.lrf_input import LRFInput
604from calibre.ebooks.conversion.plugins.chm_input import CHMInput
605from calibre.ebooks.conversion.plugins.snb_input import SNBInput
606from calibre.ebooks.conversion.plugins.docx_input import DOCXInput
607
608from calibre.ebooks.conversion.plugins.epub_output import EPUBOutput
609from calibre.ebooks.conversion.plugins.fb2_output import FB2Output
610from calibre.ebooks.conversion.plugins.lit_output import LITOutput
611from calibre.ebooks.conversion.plugins.lrf_output import LRFOutput
612from calibre.ebooks.conversion.plugins.mobi_output import (MOBIOutput,
613        AZW3Output)
614from calibre.ebooks.conversion.plugins.oeb_output import OEBOutput
615from calibre.ebooks.conversion.plugins.pdb_output import PDBOutput
616from calibre.ebooks.conversion.plugins.pdf_output import PDFOutput
617from calibre.ebooks.conversion.plugins.pml_output import PMLOutput
618from calibre.ebooks.conversion.plugins.rb_output import RBOutput
619from calibre.ebooks.conversion.plugins.rtf_output import RTFOutput
620from calibre.ebooks.conversion.plugins.tcr_output import TCROutput
621from calibre.ebooks.conversion.plugins.txt_output import TXTOutput, TXTZOutput
622from calibre.ebooks.conversion.plugins.html_output import HTMLOutput
623from calibre.ebooks.conversion.plugins.htmlz_output import HTMLZOutput
624from calibre.ebooks.conversion.plugins.snb_output import SNBOutput
625from calibre.ebooks.conversion.plugins.docx_output import DOCXOutput
626
627plugins += [
628    ComicInput,
629    DJVUInput,
630    EPUBInput,
631    FB2Input,
632    HTMLInput,
633    HTMLZInput,
634    LITInput,
635    MOBIInput,
636    ODTInput,
637    PDBInput,
638    AZW4Input,
639    PDFInput,
640    PMLInput,
641    RBInput,
642    RecipeInput,
643    RTFInput,
644    TCRInput,
645    TXTInput,
646    LRFInput,
647    CHMInput,
648    SNBInput,
649    DOCXInput,
650]
651plugins += [
652    EPUBOutput,
653    DOCXOutput,
654    FB2Output,
655    LITOutput,
656    LRFOutput,
657    MOBIOutput, AZW3Output,
658    OEBOutput,
659    PDBOutput,
660    PDFOutput,
661    PMLOutput,
662    RBOutput,
663    RTFOutput,
664    TCROutput,
665    TXTOutput,
666    TXTZOutput,
667    HTMLOutput,
668    HTMLZOutput,
669    SNBOutput,
670]
671# }}}
672
673# Catalog plugins {{{
674from calibre.library.catalogs.csv_xml import CSV_XML
675from calibre.library.catalogs.bibtex import BIBTEX
676from calibre.library.catalogs.epub_mobi import EPUB_MOBI
677plugins += [CSV_XML, BIBTEX, EPUB_MOBI]
678# }}}
679
680# Profiles {{{
681from calibre.customize.profiles import input_profiles, output_profiles
682plugins += input_profiles + output_profiles
683# }}}
684
685# Device driver plugins {{{
686from calibre.devices.hanlin.driver import HANLINV3, HANLINV5, BOOX, SPECTRA
687from calibre.devices.blackberry.driver import BLACKBERRY, PLAYBOOK
688from calibre.devices.cybook.driver import CYBOOK, ORIZON, MUSE, DIVA
689from calibre.devices.eb600.driver import (EB600, COOL_ER, SHINEBOOK, TOLINO,
690                POCKETBOOK360, GER2, ITALICA, ECLICTO, DBOOK, INVESBOOK,
691                BOOQ, ELONEX, POCKETBOOK301, MENTOR, POCKETBOOK602,
692                POCKETBOOK701, POCKETBOOK740, POCKETBOOK360P, PI2, POCKETBOOK622,
693                POCKETBOOKHD)
694from calibre.devices.iliad.driver import ILIAD
695from calibre.devices.irexdr.driver import IREXDR1000, IREXDR800
696from calibre.devices.jetbook.driver import (JETBOOK, MIBUK, JETBOOK_MINI,
697        JETBOOK_COLOR)
698from calibre.devices.kindle.driver import (KINDLE, KINDLE2, KINDLE_DX,
699        KINDLE_FIRE)
700from calibre.devices.nook.driver import NOOK, NOOK_COLOR
701from calibre.devices.prs505.driver import PRS505
702from calibre.devices.prst1.driver import PRST1
703from calibre.devices.user_defined.driver import USER_DEFINED
704from calibre.devices.android.driver import ANDROID, S60, WEBOS
705from calibre.devices.nokia.driver import N770, N810, E71X, E52
706from calibre.devices.eslick.driver import ESLICK, EBK52
707from calibre.devices.nuut2.driver import NUUT2
708from calibre.devices.iriver.driver import IRIVER_STORY
709from calibre.devices.binatone.driver import README
710from calibre.devices.hanvon.driver import (N516, EB511, ALEX, AZBOOKA, THEBOOK,
711        LIBREAIR, ODYSSEY, KIBANO)
712from calibre.devices.edge.driver import EDGE
713from calibre.devices.teclast.driver import (TECLAST_K3, NEWSMY, IPAPYRUS,
714        SOVOS, PICO, SUNSTECH_EB700, ARCHOS7O, STASH, WEXLER)
715from calibre.devices.sne.driver import SNE
716from calibre.devices.misc import (
717    PALMPRE, AVANT, SWEEX, PDNOVEL, GEMEI, VELOCITYMICRO, PDNOVEL_KOBO,
718    LUMIREAD, ALURATEK_COLOR, TREKSTOR, EEEREADER, NEXTBOOK, ADAM, MOOVYBOOK,
719    COBY, EX124G, WAYTEQ, WOXTER, POCKETBOOK626, SONYDPTS1, CERVANTES)
720from calibre.devices.folder_device.driver import FOLDER_DEVICE_FOR_CONFIG
721from calibre.devices.kobo.driver import KOBO, KOBOTOUCH
722from calibre.devices.boeye.driver import BOEYE_BEX, BOEYE_BDX
723from calibre.devices.smart_device_app.driver import SMART_DEVICE_APP
724from calibre.devices.mtp.driver import MTP_DEVICE
725
726# Order here matters. The first matched device is the one used.
727plugins += [
728    HANLINV3,
729    HANLINV5,
730    BLACKBERRY, PLAYBOOK,
731    CYBOOK, ORIZON, MUSE, DIVA,
732    ILIAD,
733    IREXDR1000,
734    IREXDR800,
735    JETBOOK, JETBOOK_MINI, MIBUK, JETBOOK_COLOR,
736    SHINEBOOK,
737    POCKETBOOK360, POCKETBOOK301, POCKETBOOK602, POCKETBOOK701, POCKETBOOK360P,
738    POCKETBOOK622, PI2, POCKETBOOKHD, POCKETBOOK740,
739    KINDLE, KINDLE2, KINDLE_DX, KINDLE_FIRE,
740    NOOK, NOOK_COLOR,
741    PRS505, PRST1,
742    ANDROID, S60, WEBOS,
743    N770,
744    E71X,
745    E52,
746    N810,
747    COOL_ER,
748    ESLICK,
749    EBK52,
750    NUUT2,
751    IRIVER_STORY,
752    GER2,
753    ITALICA,
754    ECLICTO,
755    DBOOK,
756    INVESBOOK,
757    BOOX,
758    BOOQ,
759    EB600, TOLINO,
760    README,
761    N516, KIBANO,
762    THEBOOK, LIBREAIR,
763    EB511,
764    ELONEX,
765    TECLAST_K3,
766    NEWSMY,
767    PICO, SUNSTECH_EB700, ARCHOS7O, SOVOS, STASH, WEXLER,
768    IPAPYRUS,
769    EDGE,
770    SNE,
771    ALEX, ODYSSEY,
772    PALMPRE,
773    KOBO, KOBOTOUCH,
774    AZBOOKA,
775    FOLDER_DEVICE_FOR_CONFIG,
776    AVANT, CERVANTES,
777    MENTOR,
778    SWEEX,
779    PDNOVEL,
780    SPECTRA,
781    GEMEI,
782    VELOCITYMICRO,
783    PDNOVEL_KOBO,
784    LUMIREAD,
785    ALURATEK_COLOR,
786    TREKSTOR,
787    EEEREADER,
788    NEXTBOOK,
789    ADAM,
790    MOOVYBOOK, COBY, EX124G, WAYTEQ, WOXTER, POCKETBOOK626, SONYDPTS1,
791    BOEYE_BEX,
792    BOEYE_BDX,
793    MTP_DEVICE,
794    SMART_DEVICE_APP,
795    USER_DEFINED,
796]
797
798
799# }}}
800
801# New metadata download plugins {{{
802from calibre.ebooks.metadata.sources.google import GoogleBooks
803from calibre.ebooks.metadata.sources.amazon import Amazon
804from calibre.ebooks.metadata.sources.edelweiss import Edelweiss
805from calibre.ebooks.metadata.sources.openlibrary import OpenLibrary
806from calibre.ebooks.metadata.sources.google_images import GoogleImages
807from calibre.ebooks.metadata.sources.big_book_search import BigBookSearch
808
809plugins += [GoogleBooks, GoogleImages, Amazon, Edelweiss, OpenLibrary, BigBookSearch]
810
811# }}}
812
813# Interface Actions {{{
814
815
816class ActionAdd(InterfaceActionBase):
817    name = 'Add Books'
818    actual_plugin = 'calibre.gui2.actions.add:AddAction'
819    description = _('Add books to calibre or the connected device')
820
821
822class ActionFetchAnnotations(InterfaceActionBase):
823    name = 'Fetch Annotations'
824    actual_plugin = 'calibre.gui2.actions.annotate:FetchAnnotationsAction'
825    description = _('Fetch annotations from a connected Kindle (experimental)')
826
827
828class ActionGenerateCatalog(InterfaceActionBase):
829    name = 'Generate Catalog'
830    actual_plugin = 'calibre.gui2.actions.catalog:GenerateCatalogAction'
831    description = _('Generate a catalog of the books in your calibre library')
832
833
834class ActionConvert(InterfaceActionBase):
835    name = 'Convert Books'
836    actual_plugin = 'calibre.gui2.actions.convert:ConvertAction'
837    description = _('Convert books to various e-book formats')
838
839
840class ActionPolish(InterfaceActionBase):
841    name = 'Polish Books'
842    actual_plugin = 'calibre.gui2.actions.polish:PolishAction'
843    description = _('Fine tune your e-books')
844
845
846class ActionBrowseAnnotations(InterfaceActionBase):
847    name = 'Browse Annotations'
848    actual_plugin = 'calibre.gui2.actions.browse_annots:BrowseAnnotationsAction'
849    description = _('Browse highlights and bookmarks from all books in the library')
850
851
852class ActionEditToC(InterfaceActionBase):
853    name = 'Edit ToC'
854    actual_plugin = 'calibre.gui2.actions.toc_edit:ToCEditAction'
855    description = _('Edit the Table of Contents in your books')
856
857
858class ActionDelete(InterfaceActionBase):
859    name = 'Remove Books'
860    actual_plugin = 'calibre.gui2.actions.delete:DeleteAction'
861    description = _('Delete books from your calibre library or connected device')
862
863
864class ActionEmbed(InterfaceActionBase):
865    name = 'Embed Metadata'
866    actual_plugin = 'calibre.gui2.actions.embed:EmbedAction'
867    description = _('Embed updated metadata into the actual book files in your calibre library')
868
869
870class ActionEditMetadata(InterfaceActionBase):
871    name = 'Edit Metadata'
872    actual_plugin = 'calibre.gui2.actions.edit_metadata:EditMetadataAction'
873    description = _('Edit the metadata of books in your calibre library')
874
875
876class ActionView(InterfaceActionBase):
877    name = 'View'
878    actual_plugin = 'calibre.gui2.actions.view:ViewAction'
879    description = _('Read books in your calibre library')
880
881
882class ActionFetchNews(InterfaceActionBase):
883    name = 'Fetch News'
884    actual_plugin = 'calibre.gui2.actions.fetch_news:FetchNewsAction'
885    description = _('Download news from the internet in e-book form')
886
887
888class ActionQuickview(InterfaceActionBase):
889    name = 'Quickview'
890    actual_plugin = 'calibre.gui2.actions.show_quickview:ShowQuickviewAction'
891    description = _('Show a list of related books quickly')
892
893
894class ActionTagMapper(InterfaceActionBase):
895    name = 'Tag Mapper'
896    actual_plugin = 'calibre.gui2.actions.tag_mapper:TagMapAction'
897    description = _('Filter/transform the tags for books in the library')
898
899
900class ActionAuthorMapper(InterfaceActionBase):
901    name = 'Author Mapper'
902    actual_plugin = 'calibre.gui2.actions.author_mapper:AuthorMapAction'
903    description = _('Transform the authors for books in the library')
904
905
906class ActionTemplateTester(InterfaceActionBase):
907    name = 'Template Tester'
908    actual_plugin = 'calibre.gui2.actions.show_template_tester:ShowTemplateTesterAction'
909    description = _('Show an editor for testing templates')
910
911
912class ActionTemplateFunctions(InterfaceActionBase):
913    name = 'Template Functions'
914    actual_plugin = 'calibre.gui2.actions.show_stored_templates:ShowTemplateFunctionsAction'
915    description = _('Show a dialog for creating and managing template functions and stored templates')
916
917
918class ActionSaveToDisk(InterfaceActionBase):
919    name = 'Save To Disk'
920    actual_plugin = 'calibre.gui2.actions.save_to_disk:SaveToDiskAction'
921    description = _('Export books from your calibre library to the hard disk')
922
923
924class ActionShowBookDetails(InterfaceActionBase):
925    name = 'Show Book Details'
926    actual_plugin = 'calibre.gui2.actions.show_book_details:ShowBookDetailsAction'
927    description = _('Show Book details in a separate popup')
928
929
930class ActionRestart(InterfaceActionBase):
931    name = 'Restart'
932    actual_plugin = 'calibre.gui2.actions.restart:RestartAction'
933    description = _('Restart calibre')
934
935
936class ActionOpenFolder(InterfaceActionBase):
937    name = 'Open Folder'
938    actual_plugin = 'calibre.gui2.actions.open:OpenFolderAction'
939    description = _('Open the folder that contains the book files in your'
940            ' calibre library')
941
942
943class ActionAutoscrollBooks(InterfaceActionBase):
944    name = 'Autoscroll Books'
945    actual_plugin = 'calibre.gui2.actions.auto_scroll:AutoscrollBooksAction'
946    description = _('Auto scroll through the list of books')
947
948
949class ActionSendToDevice(InterfaceActionBase):
950    name = 'Send To Device'
951    actual_plugin = 'calibre.gui2.actions.device:SendToDeviceAction'
952    description = _('Send books to the connected device')
953
954
955class ActionConnectShare(InterfaceActionBase):
956    name = 'Connect Share'
957    actual_plugin = 'calibre.gui2.actions.device:ConnectShareAction'
958    description = _('Send books via email or the web. Also connect to'
959            ' folders on your computer as if they are devices')
960
961
962class ActionHelp(InterfaceActionBase):
963    name = 'Help'
964    actual_plugin = 'calibre.gui2.actions.help:HelpAction'
965    description = _('Browse the calibre User Manual')
966
967
968class ActionPreferences(InterfaceActionBase):
969    name = 'Preferences'
970    actual_plugin = 'calibre.gui2.actions.preferences:PreferencesAction'
971    description = _('Customize calibre')
972
973
974class ActionSimilarBooks(InterfaceActionBase):
975    name = 'Similar Books'
976    actual_plugin = 'calibre.gui2.actions.similar_books:SimilarBooksAction'
977    description = _('Easily find books similar to the currently selected one')
978
979
980class ActionChooseLibrary(InterfaceActionBase):
981    name = 'Choose Library'
982    actual_plugin = 'calibre.gui2.actions.choose_library:ChooseLibraryAction'
983    description = _('Switch between different calibre libraries and perform'
984            ' maintenance on them')
985
986
987class ActionAddToLibrary(InterfaceActionBase):
988    name = 'Add To Library'
989    actual_plugin = 'calibre.gui2.actions.add_to_library:AddToLibraryAction'
990    description = _('Copy books from the device to your calibre library')
991
992
993class ActionEditCollections(InterfaceActionBase):
994    name = 'Edit Collections'
995    actual_plugin = 'calibre.gui2.actions.edit_collections:EditCollectionsAction'
996    description = _('Edit the collections in which books are placed on your device')
997
998
999class ActionMatchBooks(InterfaceActionBase):
1000    name = 'Match Books'
1001    actual_plugin = 'calibre.gui2.actions.match_books:MatchBookAction'
1002    description = _('Match book on the devices to books in the library')
1003
1004
1005class ActionShowMatchedBooks(InterfaceActionBase):
1006    name = 'Show Matched Book In Library'
1007    actual_plugin = 'calibre.gui2.actions.match_books:ShowMatchedBookAction'
1008    description = _('Show the book in the calibre library that matches this book')
1009
1010
1011class ActionCopyToLibrary(InterfaceActionBase):
1012    name = 'Copy To Library'
1013    actual_plugin = 'calibre.gui2.actions.copy_to_library:CopyToLibraryAction'
1014    description = _('Copy a book from one calibre library to another')
1015
1016
1017class ActionTweakEpub(InterfaceActionBase):
1018    name = 'Tweak ePub'
1019    actual_plugin = 'calibre.gui2.actions.tweak_epub:TweakEpubAction'
1020    description = _('Edit e-books in the EPUB or AZW3 formats')
1021
1022
1023class ActionUnpackBook(InterfaceActionBase):
1024    name = 'Unpack Book'
1025    actual_plugin = 'calibre.gui2.actions.unpack_book:UnpackBookAction'
1026    description = _('Make small changes to EPUB or HTMLZ files in your calibre library')
1027
1028
1029class ActionNextMatch(InterfaceActionBase):
1030    name = 'Next Match'
1031    actual_plugin = 'calibre.gui2.actions.next_match:NextMatchAction'
1032    description = _('Find the next or previous match when searching in '
1033            'your calibre library in highlight mode')
1034
1035
1036class ActionPickRandom(InterfaceActionBase):
1037    name = 'Pick Random Book'
1038    actual_plugin = 'calibre.gui2.actions.random:PickRandomAction'
1039    description = _('Choose a random book from your calibre library')
1040
1041
1042class ActionSortBy(InterfaceActionBase):
1043    name = 'Sort By'
1044    actual_plugin = 'calibre.gui2.actions.sort:SortByAction'
1045    description = _('Sort the list of books')
1046
1047
1048class ActionMarkBooks(InterfaceActionBase):
1049    name = 'Mark Books'
1050    actual_plugin = 'calibre.gui2.actions.mark_books:MarkBooksAction'
1051    description = _('Temporarily mark books')
1052
1053
1054class ActionVirtualLibrary(InterfaceActionBase):
1055    name = 'Virtual Library'
1056    actual_plugin = 'calibre.gui2.actions.virtual_library:VirtualLibraryAction'
1057    description = _('Change the current Virtual library')
1058
1059
1060class ActionStore(InterfaceActionBase):
1061    name = 'Store'
1062    author = 'John Schember'
1063    actual_plugin = 'calibre.gui2.actions.store:StoreAction'
1064    description = _('Search for books from different book sellers')
1065
1066    def customization_help(self, gui=False):
1067        return 'Customize the behavior of the store search.'
1068
1069    def config_widget(self):
1070        from calibre.gui2.store.config.store import config_widget as get_cw
1071        return get_cw()
1072
1073    def save_settings(self, config_widget):
1074        from calibre.gui2.store.config.store import save_settings as save
1075        save(config_widget)
1076
1077
1078class ActionPluginUpdater(InterfaceActionBase):
1079    name = 'Plugin Updater'
1080    author = 'Grant Drake'
1081    description = _('Get new calibre plugins or update your existing ones')
1082    actual_plugin = 'calibre.gui2.actions.plugin_updates:PluginUpdaterAction'
1083
1084
1085plugins += [ActionAdd, ActionFetchAnnotations, ActionGenerateCatalog,
1086        ActionConvert, ActionDelete, ActionEditMetadata, ActionView,
1087        ActionFetchNews, ActionSaveToDisk, ActionQuickview, ActionPolish,
1088        ActionShowBookDetails,ActionRestart, ActionOpenFolder, ActionConnectShare,
1089        ActionSendToDevice, ActionHelp, ActionPreferences, ActionSimilarBooks,
1090        ActionAddToLibrary, ActionEditCollections, ActionMatchBooks, ActionShowMatchedBooks, ActionChooseLibrary,
1091        ActionCopyToLibrary, ActionTweakEpub, ActionUnpackBook, ActionNextMatch, ActionStore,
1092        ActionPluginUpdater, ActionPickRandom, ActionEditToC, ActionSortBy,
1093        ActionMarkBooks, ActionEmbed, ActionTemplateTester, ActionTagMapper, ActionAuthorMapper,
1094        ActionVirtualLibrary, ActionBrowseAnnotations, ActionTemplateFunctions, ActionAutoscrollBooks]
1095
1096# }}}
1097
1098# Preferences Plugins {{{
1099
1100
1101class LookAndFeel(PreferencesPlugin):
1102    name = 'Look & Feel'
1103    icon = I('lookfeel.png')
1104    gui_name = _('Look & feel')
1105    category = 'Interface'
1106    gui_category = _('Interface')
1107    category_order = 1
1108    name_order = 1
1109    config_widget = 'calibre.gui2.preferences.look_feel'
1110    description = _('Adjust the look and feel of the calibre interface'
1111            ' to suit your tastes')
1112
1113
1114class Behavior(PreferencesPlugin):
1115    name = 'Behavior'
1116    icon = I('config.png')
1117    gui_name = _('Behavior')
1118    category = 'Interface'
1119    gui_category = _('Interface')
1120    category_order = 1
1121    name_order = 2
1122    config_widget = 'calibre.gui2.preferences.behavior'
1123    description = _('Change the way calibre behaves')
1124
1125
1126class Columns(PreferencesPlugin):
1127    name = 'Custom Columns'
1128    icon = I('column.png')
1129    gui_name = _('Add your own columns')
1130    category = 'Interface'
1131    gui_category = _('Interface')
1132    category_order = 1
1133    name_order = 3
1134    config_widget = 'calibre.gui2.preferences.columns'
1135    description = _('Add/remove your own columns to the calibre book list')
1136
1137
1138class Toolbar(PreferencesPlugin):
1139    name = 'Toolbar'
1140    icon = I('wizard.png')
1141    gui_name = _('Toolbars & menus')
1142    category = 'Interface'
1143    gui_category = _('Interface')
1144    category_order = 1
1145    name_order = 4
1146    config_widget = 'calibre.gui2.preferences.toolbar'
1147    description = _('Customize the toolbars and context menus, changing which'
1148            ' actions are available in each')
1149
1150
1151class Search(PreferencesPlugin):
1152    name = 'Search'
1153    icon = I('search.png')
1154    gui_name = _('Searching')
1155    category = 'Interface'
1156    gui_category = _('Interface')
1157    category_order = 1
1158    name_order = 5
1159    config_widget = 'calibre.gui2.preferences.search'
1160    description = _('Customize the way searching for books works in calibre')
1161
1162
1163class InputOptions(PreferencesPlugin):
1164    name = 'Input Options'
1165    icon = I('arrow-down.png')
1166    gui_name = _('Input options')
1167    category = 'Conversion'
1168    gui_category = _('Conversion')
1169    category_order = 2
1170    name_order = 1
1171    config_widget = 'calibre.gui2.preferences.conversion:InputOptions'
1172    description = _('Set conversion options specific to each input format')
1173
1174    def create_widget(self, *args, **kwargs):
1175        # The DOC Input plugin tries to override this
1176        self.config_widget = 'calibre.gui2.preferences.conversion:InputOptions'
1177        return PreferencesPlugin.create_widget(self, *args, **kwargs)
1178
1179
1180class CommonOptions(PreferencesPlugin):
1181    name = 'Common Options'
1182    icon = I('convert.png')
1183    gui_name = _('Common options')
1184    category = 'Conversion'
1185    gui_category = _('Conversion')
1186    category_order = 2
1187    name_order = 2
1188    config_widget = 'calibre.gui2.preferences.conversion:CommonOptions'
1189    description = _('Set conversion options common to all formats')
1190
1191
1192class OutputOptions(PreferencesPlugin):
1193    name = 'Output Options'
1194    icon = I('arrow-up.png')
1195    gui_name = _('Output options')
1196    category = 'Conversion'
1197    gui_category = _('Conversion')
1198    category_order = 2
1199    name_order = 3
1200    config_widget = 'calibre.gui2.preferences.conversion:OutputOptions'
1201    description = _('Set conversion options specific to each output format')
1202
1203
1204class Adding(PreferencesPlugin):
1205    name = 'Adding'
1206    icon = I('add_book.png')
1207    gui_name = _('Adding books')
1208    category = 'Import/Export'
1209    gui_category = _('Import/export')
1210    category_order = 3
1211    name_order = 1
1212    config_widget = 'calibre.gui2.preferences.adding'
1213    description = _('Control how calibre reads metadata from files when '
1214            'adding books')
1215
1216
1217class Saving(PreferencesPlugin):
1218    name = 'Saving'
1219    icon = I('save.png')
1220    gui_name = _('Saving books to disk')
1221    category = 'Import/Export'
1222    gui_category = _('Import/export')
1223    category_order = 3
1224    name_order = 2
1225    config_widget = 'calibre.gui2.preferences.saving'
1226    description = _('Control how calibre exports files from its database '
1227            'to disk when using Save to disk')
1228
1229
1230class Sending(PreferencesPlugin):
1231    name = 'Sending'
1232    icon = I('sync.png')
1233    gui_name = _('Sending books to devices')
1234    category = 'Import/Export'
1235    gui_category = _('Import/export')
1236    category_order = 3
1237    name_order = 3
1238    config_widget = 'calibre.gui2.preferences.sending'
1239    description = _('Control how calibre transfers files to your '
1240            'e-book reader')
1241
1242
1243class Plugboard(PreferencesPlugin):
1244    name = 'Plugboard'
1245    icon = I('plugboard.png')
1246    gui_name = _('Metadata plugboards')
1247    category = 'Import/Export'
1248    gui_category = _('Import/export')
1249    category_order = 3
1250    name_order = 4
1251    config_widget = 'calibre.gui2.preferences.plugboard'
1252    description = _('Change metadata fields before saving/sending')
1253
1254
1255class TemplateFunctions(PreferencesPlugin):
1256    name = 'TemplateFunctions'
1257    icon = I('template_funcs.png')
1258    gui_name = _('Template functions')
1259    category = 'Advanced'
1260    gui_category = _('Advanced')
1261    category_order = 5
1262    name_order = 5
1263    config_widget = 'calibre.gui2.preferences.template_functions'
1264    description = _('Create your own template functions')
1265
1266
1267class Email(PreferencesPlugin):
1268    name = 'Email'
1269    icon = I('mail.png')
1270    gui_name = _('Sharing books by email')
1271    category = 'Sharing'
1272    gui_category = _('Sharing')
1273    category_order = 4
1274    name_order = 1
1275    config_widget = 'calibre.gui2.preferences.emailp'
1276    description = _('Setup sharing of books via email. Can be used '
1277            'for automatic sending of downloaded news to your devices')
1278
1279
1280class Server(PreferencesPlugin):
1281    name = 'Server'
1282    icon = I('network-server.png')
1283    gui_name = _('Sharing over the net')
1284    category = 'Sharing'
1285    gui_category = _('Sharing')
1286    category_order = 4
1287    name_order = 2
1288    config_widget = 'calibre.gui2.preferences.server'
1289    description = _('Setup the calibre Content server which will '
1290            'give you access to your calibre library from anywhere, '
1291            'on any device, over the internet')
1292
1293
1294class MetadataSources(PreferencesPlugin):
1295    name = 'Metadata download'
1296    icon = I('download-metadata.png')
1297    gui_name = _('Metadata download')
1298    category = 'Sharing'
1299    gui_category = _('Sharing')
1300    category_order = 4
1301    name_order = 3
1302    config_widget = 'calibre.gui2.preferences.metadata_sources'
1303    description = _('Control how calibre downloads e-book metadata from the net')
1304
1305
1306class IgnoredDevices(PreferencesPlugin):
1307    name = 'Ignored Devices'
1308    icon = I('reader.png')
1309    gui_name = _('Ignored devices')
1310    category = 'Sharing'
1311    gui_category = _('Sharing')
1312    category_order = 4
1313    name_order = 4
1314    config_widget = 'calibre.gui2.preferences.ignored_devices'
1315    description = _('Control which devices calibre will ignore when they are connected '
1316            'to the computer.')
1317
1318
1319class Plugins(PreferencesPlugin):
1320    name = 'Plugins'
1321    icon = I('plugins.png')
1322    gui_name = _('Plugins')
1323    category = 'Advanced'
1324    gui_category = _('Advanced')
1325    category_order = 5
1326    name_order = 1
1327    config_widget = 'calibre.gui2.preferences.plugins'
1328    description = _('Add/remove/customize various bits of calibre '
1329            'functionality')
1330
1331
1332class Tweaks(PreferencesPlugin):
1333    name = 'Tweaks'
1334    icon = I('tweaks.png')
1335    gui_name = _('Tweaks')
1336    category = 'Advanced'
1337    gui_category = _('Advanced')
1338    category_order = 5
1339    name_order = 2
1340    config_widget = 'calibre.gui2.preferences.tweaks'
1341    description = _('Fine tune how calibre behaves in various contexts')
1342
1343
1344class Keyboard(PreferencesPlugin):
1345    name = 'Keyboard'
1346    icon = I('keyboard-prefs.png')
1347    gui_name = _('Shortcuts')
1348    category = 'Advanced'
1349    gui_category = _('Advanced')
1350    category_order = 5
1351    name_order = 4
1352    config_widget = 'calibre.gui2.preferences.keyboard'
1353    description = _('Customize the keyboard shortcuts used by calibre')
1354
1355
1356class Misc(PreferencesPlugin):
1357    name = 'Misc'
1358    icon = I('exec.png')
1359    gui_name = _('Miscellaneous')
1360    category = 'Advanced'
1361    gui_category = _('Advanced')
1362    category_order = 5
1363    name_order = 3
1364    config_widget = 'calibre.gui2.preferences.misc'
1365    description = _('Miscellaneous advanced configuration')
1366
1367
1368plugins += [LookAndFeel, Behavior, Columns, Toolbar, Search, InputOptions,
1369        CommonOptions, OutputOptions, Adding, Saving, Sending, Plugboard,
1370        Email, Server, Plugins, Tweaks, Misc, TemplateFunctions,
1371        MetadataSources, Keyboard, IgnoredDevices]
1372
1373# }}}
1374
1375# Store plugins {{{
1376
1377
1378class StoreAmazonKindleStore(StoreBase):
1379    name = 'Amazon Kindle'
1380    description = 'Kindle books from Amazon.'
1381    actual_plugin = 'calibre.gui2.store.stores.amazon_plugin:AmazonKindleStore'
1382
1383    headquarters = 'US'
1384    formats = ['KINDLE']
1385    affiliate = False
1386
1387
1388class StoreAmazonAUKindleStore(StoreBase):
1389    name = 'Amazon AU Kindle'
1390    author = 'Kovid Goyal'
1391    description = 'Kindle books from Amazon.'
1392    actual_plugin = 'calibre.gui2.store.stores.amazon_au_plugin:AmazonKindleStore'
1393
1394    headquarters = 'AU'
1395    formats = ['KINDLE']
1396
1397
1398class StoreAmazonCAKindleStore(StoreBase):
1399    name = 'Amazon CA Kindle'
1400    author = 'Kovid Goyal'
1401    description = 'Kindle books from Amazon.'
1402    actual_plugin = 'calibre.gui2.store.stores.amazon_ca_plugin:AmazonKindleStore'
1403
1404    headquarters = 'CA'
1405    formats = ['KINDLE']
1406
1407
1408class StoreAmazonINKindleStore(StoreBase):
1409    name = 'Amazon IN Kindle'
1410    author = 'Kovid Goyal'
1411    description = 'Kindle books from Amazon.'
1412    actual_plugin = 'calibre.gui2.store.stores.amazon_in_plugin:AmazonKindleStore'
1413
1414    headquarters = 'IN'
1415    formats = ['KINDLE']
1416
1417
1418class StoreAmazonDEKindleStore(StoreBase):
1419    name = 'Amazon DE Kindle'
1420    author = 'Kovid Goyal'
1421    description = 'Kindle Bücher von Amazon.'
1422    actual_plugin = 'calibre.gui2.store.stores.amazon_de_plugin:AmazonKindleStore'
1423
1424    headquarters = 'DE'
1425    formats = ['KINDLE']
1426
1427
1428class StoreAmazonFRKindleStore(StoreBase):
1429    name = 'Amazon FR Kindle'
1430    author = 'Kovid Goyal'
1431    description = 'Tous les e-books Kindle'
1432    actual_plugin = 'calibre.gui2.store.stores.amazon_fr_plugin:AmazonKindleStore'
1433
1434    headquarters = 'FR'
1435    formats = ['KINDLE']
1436
1437
1438class StoreAmazonITKindleStore(StoreBase):
1439    name = 'Amazon IT Kindle'
1440    author = 'Kovid Goyal'
1441    description = 'e-book Kindle a prezzi incredibili'
1442    actual_plugin = 'calibre.gui2.store.stores.amazon_it_plugin:AmazonKindleStore'
1443
1444    headquarters = 'IT'
1445    formats = ['KINDLE']
1446
1447
1448class StoreAmazonESKindleStore(StoreBase):
1449    name = 'Amazon ES Kindle'
1450    author = 'Kovid Goyal'
1451    description = 'e-book Kindle en España'
1452    actual_plugin = 'calibre.gui2.store.stores.amazon_es_plugin:AmazonKindleStore'
1453
1454    headquarters = 'ES'
1455    formats = ['KINDLE']
1456
1457
1458class StoreAmazonUKKindleStore(StoreBase):
1459    name = 'Amazon UK Kindle'
1460    author = 'Kovid Goyal'
1461    description = 'Kindle books from Amazon\'s UK web site. Also, includes French language e-books.'
1462    actual_plugin = 'calibre.gui2.store.stores.amazon_uk_plugin:AmazonKindleStore'
1463
1464    headquarters = 'UK'
1465    formats = ['KINDLE']
1466
1467
1468class StoreArchiveOrgStore(StoreBase):
1469    name = 'Archive.org'
1470    description = 'An Internet library offering permanent access for researchers, historians, scholars, people with disabilities, and the general public to historical collections that exist in digital format.'  # noqa
1471    actual_plugin = 'calibre.gui2.store.stores.archive_org_plugin:ArchiveOrgStore'
1472
1473    drm_free_only = True
1474    headquarters = 'US'
1475    formats = ['DAISY', 'DJVU', 'EPUB', 'MOBI', 'PDF', 'TXT']
1476
1477
1478class StoreBubokPublishingStore(StoreBase):
1479    name = 'Bubok Spain'
1480    description = 'Bubok Publishing is a publisher, library and store of books of authors from all around the world. They have a big amount of books of a lot of topics'  # noqa
1481    actual_plugin = 'calibre.gui2.store.stores.bubok_publishing_plugin:BubokPublishingStore'
1482
1483    drm_free_only = True
1484    headquarters = 'ES'
1485    formats = ['EPUB', 'PDF']
1486
1487
1488class StoreBubokPortugalStore(StoreBase):
1489    name = 'Bubok Portugal'
1490    description = 'Bubok Publishing Portugal is a publisher, library and store of books of authors from Portugal. They have a big amount of books of a lot of topics'  # noqa
1491    actual_plugin = 'calibre.gui2.store.stores.bubok_portugal_plugin:BubokPortugalStore'
1492
1493    drm_free_only = True
1494    headquarters = 'PT'
1495    formats = ['EPUB', 'PDF']
1496
1497
1498class StoreBaenWebScriptionStore(StoreBase):
1499    name = 'Baen Ebooks'
1500    description = 'Sci-Fi & Fantasy brought to you by Jim Baen.'
1501    actual_plugin = 'calibre.gui2.store.stores.baen_webscription_plugin:BaenWebScriptionStore'
1502
1503    drm_free_only = True
1504    headquarters = 'US'
1505    formats = ['EPUB', 'LIT', 'LRF', 'MOBI', 'RB', 'RTF', 'ZIP']
1506
1507
1508class StoreBNStore(StoreBase):
1509    name = 'Barnes and Noble'
1510    description = 'The world\'s largest book seller. As the ultimate destination for book lovers, Barnes & Noble.com offers an incredible array of content.'
1511    actual_plugin = 'calibre.gui2.store.stores.bn_plugin:BNStore'
1512
1513    headquarters = 'US'
1514    formats = ['NOOK']
1515
1516
1517class StoreBeamEBooksDEStore(StoreBase):
1518    name = 'Beam EBooks DE'
1519    author = 'Charles Haley'
1520    description = 'Bei uns finden Sie: Tausende deutschsprachige e-books; Alle e-books ohne hartes DRM; PDF, ePub und Mobipocket Format; Sofortige Verfügbarkeit - 24 Stunden am Tag; Günstige Preise; e-books für viele Lesegeräte, PC,Mac und Smartphones; Viele Gratis e-books'  # noqa
1521    actual_plugin = 'calibre.gui2.store.stores.beam_ebooks_de_plugin:BeamEBooksDEStore'
1522
1523    drm_free_only = True
1524    headquarters = 'DE'
1525    formats = ['EPUB', 'MOBI', 'PDF']
1526
1527
1528class StoreBiblioStore(StoreBase):
1529    name = 'Библио.бг'
1530    author = 'Alex Stanev'
1531    description = 'Електронна книжарница за книги и списания във формати ePUB и PDF. Част от заглавията са с активна DRM защита.'
1532    actual_plugin = 'calibre.gui2.store.stores.biblio_plugin:BiblioStore'
1533
1534    headquarters = 'BG'
1535    formats = ['EPUB, PDF']
1536
1537
1538class StoreChitankaStore(StoreBase):
1539    name = 'Моята библиотека'
1540    author = 'Alex Stanev'
1541    description = 'Независим сайт за DRM свободна литература на български език'
1542    actual_plugin = 'calibre.gui2.store.stores.chitanka_plugin:ChitankaStore'
1543
1544    drm_free_only = True
1545    headquarters = 'BG'
1546    formats = ['FB2', 'EPUB', 'TXT', 'SFB']
1547
1548
1549class StoreEbookNLStore(StoreBase):
1550    name = 'eBook.nl'
1551    description = 'De eBookwinkel van Nederland'
1552    actual_plugin = 'calibre.gui2.store.stores.ebook_nl_plugin:EBookNLStore'
1553
1554    headquarters = 'NL'
1555    formats = ['EPUB', 'PDF']
1556    affiliate = False
1557
1558
1559class StoreEbookpointStore(StoreBase):
1560    name = 'Ebookpoint'
1561    author = 'Tomasz Długosz'
1562    description = 'E-booki wolne od DRM, 3 formaty w pakiecie, wysyłanie na Kindle'
1563    actual_plugin = 'calibre.gui2.store.stores.ebookpoint_plugin:EbookpointStore'
1564
1565    drm_free_only = True
1566    headquarters = 'PL'
1567    formats = ['EPUB', 'MOBI', 'PDF']
1568    affiliate = True
1569
1570
1571class StoreEbookscomStore(StoreBase):
1572    name = 'eBooks.com'
1573    description = 'Sells books in multiple electronic formats in all categories. Technical infrastructure is cutting edge, robust and scalable, with servers in the US and Europe.'  # noqa
1574    actual_plugin = 'calibre.gui2.store.stores.ebooks_com_plugin:EbookscomStore'
1575
1576    headquarters = 'US'
1577    formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
1578    affiliate = True
1579
1580
1581class StoreEbooksGratuitsStore(StoreBase):
1582    name = 'EbooksGratuits.com'
1583    description = 'Ebooks Libres et Gratuits'
1584    actual_plugin = 'calibre.gui2.store.stores.ebooksgratuits_plugin:EbooksGratuitsStore'
1585
1586    headquarters = 'FR'
1587    formats = ['EPUB', 'MOBI', 'PDF', 'PDB']
1588    drm_free_only = True
1589
1590# class StoreEBookShoppeUKStore(StoreBase):
1591#     name = 'ebookShoppe UK'
1592#     author = 'Charles Haley'
1593#     description = 'We made this website in an attempt to offer the widest range of UK eBooks possible across and as many formats as we could manage.'
1594#     actual_plugin = 'calibre.gui2.store.stores.ebookshoppe_uk_plugin:EBookShoppeUKStore'
1595#
1596#     headquarters = 'UK'
1597#     formats = ['EPUB', 'PDF']
1598#     affiliate = True
1599
1600
1601class StoreEmpikStore(StoreBase):
1602    name = 'Empik'
1603    author = 'Tomasz Długosz'
1604    description  = 'Empik to marka o unikalnym dziedzictwie i legendarne miejsce, dawne “okno na świat”. Jest obecna w polskim krajobrazie kulturalnym od 60 lat (wcześniej jako Kluby Międzynarodowej Prasy i Książki).'  # noqa
1605    actual_plugin = 'calibre.gui2.store.stores.empik_plugin:EmpikStore'
1606
1607    headquarters = 'PL'
1608    formats = ['EPUB', 'MOBI', 'PDF']
1609    affiliate = True
1610
1611
1612class StoreFeedbooksStore(StoreBase):
1613    name = 'Feedbooks'
1614    description = 'Feedbooks is a cloud publishing and distribution service, connected to a large ecosystem of reading systems and social networks. Provides a variety of genres from independent and classic books.'  # noqa
1615    actual_plugin = 'calibre.gui2.store.stores.feedbooks_plugin:FeedbooksStore'
1616
1617    headquarters = 'FR'
1618    formats = ['EPUB', 'MOBI', 'PDF']
1619
1620
1621class StoreGoogleBooksStore(StoreBase):
1622    name = 'Google Books'
1623    description = 'Google Books'
1624    actual_plugin = 'calibre.gui2.store.stores.google_books_plugin:GoogleBooksStore'
1625
1626    headquarters = 'US'
1627    formats = ['EPUB', 'PDF', 'TXT']
1628
1629
1630class StoreGutenbergStore(StoreBase):
1631    name = 'Project Gutenberg'
1632    description = 'The first producer of free e-books. Free in the United States because their copyright has expired. They may not be free of copyright in other countries. Readers outside of the United States must check the copyright laws of their countries before downloading or redistributing our e-books.'  # noqa
1633    actual_plugin = 'calibre.gui2.store.stores.gutenberg_plugin:GutenbergStore'
1634
1635    drm_free_only = True
1636    headquarters = 'US'
1637    formats = ['EPUB', 'HTML', 'MOBI', 'PDB', 'TXT']
1638
1639
1640class StoreKoboStore(StoreBase):
1641    name = 'Kobo'
1642    description = 'With over 2.3 million e-books to browse we have engaged readers in over 200 countries in Kobo eReading. Our e-book listings include New York Times Bestsellers, award winners, classics and more!'  # noqa
1643    actual_plugin = 'calibre.gui2.store.stores.kobo_plugin:KoboStore'
1644
1645    headquarters = 'CA'
1646    formats = ['EPUB']
1647    affiliate = True
1648
1649
1650class StoreLegimiStore(StoreBase):
1651    name = 'Legimi'
1652    author = 'Tomasz Długosz'
1653    description = 'E-booki w formacie EPUB, MOBI i PDF'
1654    actual_plugin = 'calibre.gui2.store.stores.legimi_plugin:LegimiStore'
1655
1656    headquarters = 'PL'
1657    formats = ['EPUB', 'PDF', 'MOBI']
1658    affiliate = True
1659
1660
1661class StoreLibreDEStore(StoreBase):
1662    name = 'ebook.de'
1663    author = 'Charles Haley'
1664    description = 'All Ihre Bücher immer dabei. Suchen, finden, kaufen: so einfach wie nie. ebook.de war libre.de'
1665    actual_plugin = 'calibre.gui2.store.stores.libri_de_plugin:LibreDEStore'
1666
1667    headquarters = 'DE'
1668    formats = ['EPUB', 'PDF']
1669    affiliate = True
1670
1671
1672class StoreLitResStore(StoreBase):
1673    name = 'LitRes'
1674    description = 'e-books from LitRes.ru'
1675    actual_plugin = 'calibre.gui2.store.stores.litres_plugin:LitResStore'
1676    author = 'Roman Mukhin'
1677
1678    drm_free_only = False
1679    headquarters = 'RU'
1680    formats = ['EPUB', 'TXT', 'RTF', 'HTML', 'FB2', 'LRF', 'PDF', 'MOBI', 'LIT', 'ISILO3', 'JAR', 'RB', 'PRC']
1681    affiliate = True
1682
1683
1684class StoreManyBooksStore(StoreBase):
1685    name = 'ManyBooks'
1686    description = 'Public domain and creative commons works from many sources.'
1687    actual_plugin = 'calibre.gui2.store.stores.manybooks_plugin:ManyBooksStore'
1688
1689    drm_free_only = True
1690    headquarters = 'US'
1691    formats = ['EPUB', 'FB2', 'JAR', 'LIT', 'LRF', 'MOBI', 'PDB', 'PDF', 'RB', 'RTF', 'TCR', 'TXT', 'ZIP']
1692
1693
1694class StoreMillsBoonUKStore(StoreBase):
1695    name = 'Mills and Boon UK'
1696    author = 'Charles Haley'
1697    description = '"Bring Romance to Life" "[A] hallmark for romantic fiction, recognised around the world."'
1698    actual_plugin = 'calibre.gui2.store.stores.mills_boon_uk_plugin:MillsBoonUKStore'
1699
1700    headquarters = 'UK'
1701    formats = ['EPUB']
1702    affiliate = False
1703
1704
1705class StoreMobileReadStore(StoreBase):
1706    name = 'MobileRead'
1707    description = 'E-books handcrafted with the utmost care.'
1708    actual_plugin = 'calibre.gui2.store.stores.mobileread.mobileread_plugin:MobileReadStore'
1709
1710    drm_free_only = True
1711    headquarters = 'CH'
1712    formats = ['EPUB', 'IMP', 'LRF', 'LIT', 'MOBI', 'PDF']
1713
1714
1715class StoreNextoStore(StoreBase):
1716    name = 'Nexto'
1717    author = 'Tomasz Długosz'
1718    description = 'Największy w Polsce sklep internetowy z audiobookami mp3, ebookami pdf oraz prasą do pobrania on-line.'
1719    actual_plugin = 'calibre.gui2.store.stores.nexto_plugin:NextoStore'
1720
1721    headquarters = 'PL'
1722    formats = ['EPUB', 'MOBI', 'PDF']
1723    affiliate = True
1724
1725
1726class StoreOzonRUStore(StoreBase):
1727    name = 'OZON.ru'
1728    description = 'e-books from OZON.ru'
1729    actual_plugin = 'calibre.gui2.store.stores.ozon_ru_plugin:OzonRUStore'
1730    author = 'Roman Mukhin'
1731
1732    drm_free_only = True
1733    headquarters = 'RU'
1734    formats = ['TXT', 'PDF', 'DJVU', 'RTF', 'DOC', 'JAR', 'FB2']
1735    affiliate = True
1736
1737
1738class StorePragmaticBookshelfStore(StoreBase):
1739    name = 'Pragmatic Bookshelf'
1740    description = 'The Pragmatic Bookshelf\'s collection of programming and tech books available as e-books.'
1741    actual_plugin = 'calibre.gui2.store.stores.pragmatic_bookshelf_plugin:PragmaticBookshelfStore'
1742
1743    drm_free_only = True
1744    headquarters = 'US'
1745    formats = ['EPUB', 'MOBI', 'PDF']
1746
1747
1748class StorePublioStore(StoreBase):
1749    name = 'Publio'
1750    description = 'Publio.pl to księgarnia internetowa, w której mogą Państwo nabyć e-booki i audiobooki.'
1751    actual_plugin = 'calibre.gui2.store.stores.publio_plugin:PublioStore'
1752    author = 'Tomasz Długosz'
1753
1754    headquarters = 'PL'
1755    formats = ['EPUB', 'MOBI', 'PDF']
1756    affiliate = True
1757
1758
1759class StoreRW2010Store(StoreBase):
1760    name = 'RW2010'
1761    description = 'Polski serwis self-publishingowy. Pliki PDF, EPUB i MOBI.'
1762    actual_plugin = 'calibre.gui2.store.stores.rw2010_plugin:RW2010Store'
1763    author = 'Tomasz Długosz'
1764
1765    drm_free_only = True
1766    headquarters = 'PL'
1767    formats = ['EPUB', 'MOBI', 'PDF']
1768
1769
1770class StoreSmashwordsStore(StoreBase):
1771    name = 'Smashwords'
1772    description = 'An e-book publishing and distribution platform for e-book authors, publishers and readers. Covers many genres and formats.'
1773    actual_plugin = 'calibre.gui2.store.stores.smashwords_plugin:SmashwordsStore'
1774
1775    drm_free_only = True
1776    headquarters = 'US'
1777    formats = ['EPUB', 'HTML', 'LRF', 'MOBI', 'PDB', 'RTF', 'TXT']
1778    affiliate = True
1779
1780
1781class StoreSwiatEbookowStore(StoreBase):
1782    name = 'Świat Ebooków'
1783    author = 'Tomasz Długosz'
1784    description = 'Ebooki maje tę zaletę, że są zawsze i wszędzie tam, gdzie tylko nas dopadnie ochota na czytanie.'
1785    actual_plugin = 'calibre.gui2.store.stores.swiatebookow_plugin:SwiatEbookowStore'
1786
1787    drm_free_only = True
1788    headquarters = 'PL'
1789    formats = ['EPUB', 'MOBI', 'PDF']
1790    affiliate = True
1791
1792
1793class StoreVirtualoStore(StoreBase):
1794    name = 'Virtualo'
1795    author = 'Tomasz Długosz'
1796    description = 'Księgarnia internetowa, która oferuje bezpieczny i szeroki dostęp do książek w formie cyfrowej.'
1797    actual_plugin = 'calibre.gui2.store.stores.virtualo_plugin:VirtualoStore'
1798
1799    headquarters = 'PL'
1800    formats = ['EPUB', 'MOBI', 'PDF']
1801    affiliate = True
1802
1803
1804class StoreWeightlessBooksStore(StoreBase):
1805    name = 'Weightless Books'
1806    description = 'An independent DRM-free e-book site devoted to e-books of all sorts.'
1807    actual_plugin = 'calibre.gui2.store.stores.weightless_books_plugin:WeightlessBooksStore'
1808
1809    drm_free_only = True
1810    headquarters = 'US'
1811    formats = ['EPUB', 'HTML', 'LIT', 'MOBI', 'PDF']
1812
1813
1814class StoreWolneLekturyStore(StoreBase):
1815    name = 'Wolne Lektury'
1816    author = 'Tomasz Długosz'
1817    description = 'Wolne Lektury to biblioteka internetowa czynna 24 godziny na dobę, 365 dni w roku, której zasoby dostępne są całkowicie za darmo. Wszystkie dzieła są odpowiednio opracowane - opatrzone przypisami, motywami i udostępnione w kilku formatach - HTML, TXT, PDF, EPUB, MOBI, FB2.'  # noqa
1818    actual_plugin = 'calibre.gui2.store.stores.wolnelektury_plugin:WolneLekturyStore'
1819
1820    headquarters = 'PL'
1821    formats = ['EPUB', 'MOBI', 'PDF', 'TXT', 'FB2']
1822
1823
1824class StoreWoblinkStore(StoreBase):
1825    name = 'Woblink'
1826    author = 'Tomasz Długosz'
1827    description = 'Czytanie zdarza się wszędzie!'
1828    actual_plugin = 'calibre.gui2.store.stores.woblink_plugin:WoblinkStore'
1829
1830    headquarters = 'PL'
1831    formats = ['EPUB', 'MOBI', 'PDF', 'WOBLINK']
1832    affiliate = True
1833
1834
1835class XinXiiStore(StoreBase):
1836    name = 'XinXii'
1837    description = ''
1838    actual_plugin = 'calibre.gui2.store.stores.xinxii_plugin:XinXiiStore'
1839
1840    headquarters = 'DE'
1841    formats = ['EPUB', 'PDF']
1842
1843
1844plugins += [
1845    StoreArchiveOrgStore,
1846    StoreBubokPublishingStore,
1847    StoreBubokPortugalStore,
1848    StoreAmazonKindleStore,
1849    StoreAmazonAUKindleStore,
1850    StoreAmazonCAKindleStore,
1851    StoreAmazonINKindleStore,
1852    StoreAmazonDEKindleStore,
1853    StoreAmazonESKindleStore,
1854    StoreAmazonFRKindleStore,
1855    StoreAmazonITKindleStore,
1856    StoreAmazonUKKindleStore,
1857    StoreBaenWebScriptionStore,
1858    StoreBNStore,
1859    StoreBeamEBooksDEStore,
1860    StoreBiblioStore,
1861    StoreChitankaStore,
1862    StoreEbookNLStore,
1863    StoreEbookpointStore,
1864    StoreEbookscomStore,
1865    StoreEbooksGratuitsStore,
1866    StoreEmpikStore,
1867    StoreFeedbooksStore,
1868    StoreGoogleBooksStore,
1869    StoreGutenbergStore,
1870    StoreKoboStore,
1871    StoreLegimiStore,
1872    StoreLibreDEStore,
1873    StoreLitResStore,
1874    StoreManyBooksStore,
1875    StoreMillsBoonUKStore,
1876    StoreMobileReadStore,
1877    StoreNextoStore,
1878    StoreOzonRUStore,
1879    StorePragmaticBookshelfStore,
1880    StorePublioStore,
1881    StoreRW2010Store,
1882    StoreSmashwordsStore,
1883    StoreSwiatEbookowStore,
1884    StoreVirtualoStore,
1885    StoreWeightlessBooksStore,
1886    StoreWolneLekturyStore,
1887    StoreWoblinkStore,
1888    XinXiiStore
1889]
1890
1891# }}}
1892
1893if __name__ == '__main__':
1894    # Test load speed
1895    import subprocess, textwrap
1896    try:
1897        subprocess.check_call(['python', '-c', textwrap.dedent(
1898        '''
1899        import init_calibre  # noqa
1900
1901        def doit():
1902            import calibre.customize.builtins as b  # noqa
1903
1904        def show_stats():
1905            from pstats import Stats
1906            s = Stats('/tmp/calibre_stats')
1907            s.sort_stats('cumulative')
1908            s.print_stats(30)
1909
1910        import cProfile
1911        cProfile.run('doit()', '/tmp/calibre_stats')
1912        show_stats()
1913
1914        '''
1915        )])
1916    except subprocess.CalledProcessError:
1917        raise SystemExit(1)
1918    try:
1919        subprocess.check_call(['python', '-c', textwrap.dedent(
1920        '''
1921        import time, sys, init_calibre
1922        st = time.time()
1923        import calibre.customize.builtins
1924        t = time.time() - st
1925        ret = 0
1926
1927        for x in ('lxml', 'calibre.ebooks.BeautifulSoup', 'uuid',
1928            'calibre.utils.terminal', 'calibre.utils.img', 'PIL', 'Image',
1929            'sqlite3', 'mechanize', 'httplib', 'xml', 'inspect', 'urllib',
1930            'calibre.utils.date', 'calibre.utils.config', 'platform',
1931            'calibre.utils.zipfile', 'calibre.utils.formatter',
1932        ):
1933            if x in sys.modules:
1934                ret = 1
1935                print (x, 'has been loaded by a plugin')
1936        if ret:
1937            print ('\\nA good way to track down what is loading something is to run'
1938            ' python -c "import init_calibre; import calibre.customize.builtins"')
1939            print()
1940        print ('Time taken to import all plugins: %.2f'%t)
1941        sys.exit(ret)
1942
1943        ''')])
1944    except subprocess.CalledProcessError:
1945        raise SystemExit(1)
1946