author/title match ordering in api filter-books + fix lektura/audiobook filters
[wolnelektury.git] / src / catalogue / management / commands / gencover.py
index adb84ea..5afd1ba 100644 (file)
@@ -5,17 +5,19 @@
 from django.core.management.base import BaseCommand
 
 from catalogue.models import Book
 from django.core.management.base import BaseCommand
 
 from catalogue.models import Book
-from librarian.cover import DefaultEbookCover
+from librarian.cover import make_cover
 
 
 class Command(BaseCommand):
     def add_arguments(self, parser):
         parser.add_argument('slug')
         parser.add_argument('size', type=int)
 
 
 class Command(BaseCommand):
     def add_arguments(self, parser):
         parser.add_argument('slug')
         parser.add_argument('size', type=int)
+        parser.add_argument('--bleed', action='store_true')
 
     def handle(self, *args, **options):
         slug = options['slug']
         size = options['size']
 
     def handle(self, *args, **options):
         slug = options['slug']
         size = options['size']
+        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)
+        cover = make_cover(wldoc.book_info, width=size, bleed=bleed)
         cover.save('%s.jpg' % slug)
         cover.save('%s.jpg' % slug)