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 files for Gandalf')
27 parser.add_option('--virtualo', action='store_true', dest='virtualo', default=False,
28 help='prepare files for Virtualo API')
29 parser.add_option('--prestigio', action='store_true', dest='prestigio', default=False,
30 help='prepare files for Prestigio')
31 parser.add_option('--prestigio-pdf', action='store_true', dest='prestigio_pdf', default=False,
32 help='prepare PDF files for Prestigio')
34 options, input_filenames = parser.parse_args()
36 if len(input_filenames) < 1:
41 packagers.BookotekaEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
43 packagers.GandalfEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
45 packagers.VirtualoEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
47 packagers.PrestigioEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
48 if options.prestigio_pdf:
49 packagers.PrestigioPdfPackager.prepare(input_filenames, options.output_dir, options.verbose)