default cover
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 27 Jan 2012 18:39:05 +0000 (19:39 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 27 Jan 2012 18:39:05 +0000 (19:39 +0100)
librarian/cover.py
librarian/res/shaireproductions-4945819544-cc-by.jpg [new file with mode: 0644]
scripts/book2cover

index 63e4aa0..0416628 100644 (file)
@@ -192,6 +192,8 @@ class WLCover(Cover):
     bar_width = 35
     background_color = '#444'
     author_color = '#444'
+    default_background = get_resource('res/background.jpg')
+    format = 'JPEG'
 
     epochs = {
         u'Starożytność': 0,
@@ -217,6 +219,8 @@ class WLCover(Cover):
             bg_src = urlopen(book_info.cover_url)
             self.background_img = StringIO(bg_src.read())
             bg_src.close()
+        else:
+            self.background_img = self.default_background
 
     def pretty_author(self):
         return self.author.upper()
diff --git a/librarian/res/shaireproductions-4945819544-cc-by.jpg b/librarian/res/shaireproductions-4945819544-cc-by.jpg
new file mode 100644 (file)
index 0000000..f2a19e3
Binary files /dev/null and b/librarian/res/shaireproductions-4945819544-cc-by.jpg differ
index d2befc3..49cd539 100755 (executable)
@@ -33,7 +33,7 @@ if __name__ == '__main__':
         if options.verbose:
             print input_filename
 
-        output_filename = os.path.splitext(input_filename)[0] + '.png'
+        output_filename = os.path.splitext(input_filename)[0] + '.jpg'
 
         doc = WLDocument.from_file(input_filename)
         WLCover(doc.book_info).save(output_filename)