2 # -*- coding: utf-8 -*-
4 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
9 from librarian import packagers
12 if __name__ == '__main__':
13 # Parse commandline arguments
14 usage = """Usage: %prog [options] SOURCE [SOURCE...]
15 Prepare SOURCE files for a partner."""
17 parser = optparse.OptionParser(usage=usage)
19 parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False,
20 help='print status messages to stdout')
21 parser.add_option('-O', '--output-dir', dest='output_dir', metavar='DIR', default='',
22 help='specifies the directory for output')
23 parser.add_option('--bookoteka', action='store_true', dest='bookoteka', default=False,
24 help='prepare files for Bookoteka')
25 parser.add_option('--gandalf', action='store_true', dest='gandalf', default=False,
26 help='prepare EPUB files for Gandalf')
27 parser.add_option('--gandalf-pdf', action='store_true', dest='gandalf_pdf', default=False,
28 help='prepare PDF files for Gandalf')
29 parser.add_option('--virtualo', action='store_true', dest='virtualo', default=False,
30 help='prepare files for Virtualo API')
31 parser.add_option('--prestigio', action='store_true', dest='prestigio', default=False,
32 help='prepare files for Prestigio')
33 parser.add_option('--prestigio-pdf', action='store_true', dest='prestigio_pdf', default=False,
34 help='prepare PDF files for Prestigio')
36 options, input_filenames = parser.parse_args()
38 if len(input_filenames) < 1:
43 packagers.BookotekaEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
45 packagers.GandalfEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
46 if options.gandalf_pdf:
47 packagers.GandalfPdfPackager.prepare(input_filenames, options.output_dir, options.verbose)
49 packagers.VirtualoEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
51 packagers.PrestigioEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
52 if options.prestigio_pdf:
53 packagers.PrestigioPdfPackager.prepare(input_filenames, options.output_dir, options.verbose)