-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-import optparse
-
-from librarian import packagers
-
-
-if __name__ == '__main__':
- # Parse commandline arguments
- usage = """Usage: %prog [options] SOURCE [SOURCE...]
- Prepare SOURCE files for a partner."""
-
- parser = optparse.OptionParser(usage=usage)
-
- parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False,
- help='print status messages to stdout')
- parser.add_option('-O', '--output-dir', dest='output_dir', metavar='DIR', default='',
- help='specifies the directory for output')
- parser.add_option('--bookoteka', action='store_true', dest='bookoteka', default=False,
- help='prepare files for Bookoteka')
- parser.add_option('--gandalf', action='store_true', dest='gandalf', default=False,
- help='prepare EPUB files for Gandalf')
- parser.add_option('--gandalf-pdf', action='store_true', dest='gandalf_pdf', default=False,
- help='prepare PDF files for Gandalf')
- parser.add_option('--virtualo', action='store_true', dest='virtualo', default=False,
- help='prepare files for Virtualo API')
- parser.add_option('--prestigio', action='store_true', dest='prestigio', default=False,
- help='prepare files for Prestigio')
- parser.add_option('--prestigio-pdf', action='store_true', dest='prestigio_pdf', default=False,
- help='prepare PDF files for Prestigio')
-
- options, input_filenames = parser.parse_args()
-
- if len(input_filenames) < 1:
- parser.print_help()
- exit(1)
-
- if options.bookoteka:
- packagers.BookotekaEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
- if options.gandalf:
- packagers.GandalfEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
- if options.gandalf_pdf:
- packagers.GandalfPdfPackager.prepare(input_filenames, options.output_dir, options.verbose)
- if options.virtualo:
- packagers.VirtualoPackager.prepare(input_filenames, options.output_dir, options.verbose)
- if options.prestigio:
- packagers.PrestigioEpubPackager.prepare(input_filenames, options.output_dir, options.verbose)
- if options.prestigio_pdf:
- packagers.PrestigioPdfPackager.prepare(input_filenames, options.output_dir, options.verbose)