fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes
[wolnelektury.git]
/
src
/
catalogue
/
management
/
commands
/
gencover.py
diff --git
a/src/catalogue/management/commands/gencover.py
b/src/catalogue/management/commands/gencover.py
index
adb84ea
..
c0d099b
100644
(file)
--- a/
src/catalogue/management/commands/gencover.py
+++ b/
src/catalogue/management/commands/gencover.py
@@
-1,21
+1,29
@@
-# -*- 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.
#
from django.core.management.base import BaseCommand
from catalogue.models import Book
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.core.management.base import BaseCommand
from catalogue.models import Book
-from librarian.cover import
DefaultEbookC
over
+from librarian.cover import
make_c
over
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('slug')
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('slug')
- parser.add_argument('size', type=int)
+ 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']
def handle(self, *args, **options):
slug = options['slug']
- size = options['size']
+ 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()
wldoc = Book.objects.get(slug=slug).wldocument()
- cover = DefaultEbookCover(wldoc.book_info, width=size)
+ 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)
cover.save('%s.jpg' % slug)