X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3d9be6abb7457c06dd81f6e2bc41984bb656fab4..9f982b5217a21f9b59e72db4aa228abd5625c658:/src/catalogue/management/commands/gencover.py diff --git a/src/catalogue/management/commands/gencover.py b/src/catalogue/management/commands/gencover.py index 420ea6348..c0d099b60 100644 --- a/src/catalogue/management/commands/gencover.py +++ b/src/catalogue/management/commands/gencover.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # @@ -14,12 +13,17 @@ class Command(BaseCommand): parser.add_argument('--width', type=int) parser.add_argument('--height', type=int) parser.add_argument('--bleed', action='store_true') + parser.add_argument('--cover-class', type=str) def handle(self, *args, **options): slug = options['slug'] width = options['width'] height = options.get('height') + cover_class = options.get('cover_class') bleed = 20 if options['bleed'] else 0 wldoc = Book.objects.get(slug=slug).wldocument() - cover = make_cover(wldoc.book_info, width=width, height=height, bleed=bleed) + kwargs = {} + if cover_class: + kwargs['cover_class'] = cover_class + cover = make_cover(wldoc.book_info, width=width, height=height, bleed=bleed, **kwargs) cover.save('%s.jpg' % slug)