[epub, mobi] fix for notes without margin-bottom. Issue #2567
[librarian.git] / scripts / book2cover
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 #
7 from StringIO import StringIO
8 from librarian import OutputFile
9 from librarian.book2anything import Book2Anything, Option
10
11
12 class Book2Cover(Book2Anything):
13     format_name = "JPEG"
14     ext = "jpg"
15     uses_cover = True
16     cover_optional = False
17
18     transform_options = [
19         Option('-W', '--width', action='store', type='int', dest='width', default=None,
20                 help='Set width.'),
21         Option('-H', '--height', action='store', type='int', dest='height', default=None,
22                 help='Set height.'),
23         Option('-l', '--with-logo', dest='with_logo',
24                 action='store_true', default=False,
25                 help='Add WL logo in white box.'),
26     ]
27
28     @staticmethod
29     def transform(wldoc, cover, *args, **kwargs):
30         return wldoc.as_cover(cover_class=cover, *args, **kwargs)
31
32
33 if __name__ == '__main__':
34     Book2Cover.run()