Release with current fixes. 2.3.4
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 28 Feb 2022 14:59:30 +0000 (15:59 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 28 Feb 2022 14:59:30 +0000 (15:59 +0100)
CHANGELOG.md
setup.py
src/librarian/cover.py
src/librarian/parser.py

index 0366bf8..d19c282 100644 (file)
@@ -3,6 +3,13 @@
 This document records all notable changes to Librarian.
 
 
+## 2.3.4 (2022-02-28)
+
+### Fixed:
+- Document stats totaling bug.
+- Legimi cover background position.
+
+
 ## 2.3.3 (2021-12-23)
 
 ### Added:
index d3c4afe..c89f5a1 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def whole_tree(prefix, path):
 
 setup(
     name='librarian',
-    version='2.3.3',
+    version='2.3.4',
     description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
     author="Marek Stępniowski",
     author_email='marek@stepniowski.com',
index d9b76ea..dfb0b76 100644 (file)
@@ -289,6 +289,7 @@ class WLCover(Cover):
     background_color = '#444'
     author_color = '#444'
     background_img = get_resource('res/cover.png')
+    background_top = False
     format = 'JPEG'
 
     epoch_colors = {
@@ -478,7 +479,10 @@ class WLCover(Cover):
                     trg_size[0],
                     int(round(src.size[1] * trg_size[0] / src.size[0]))
                 )
-                cut = (resized[1] - trg_size[1]) // 2
+                if self.background_top:
+                    cut = 0
+                else:
+                    cut = (resized[1] - trg_size[1]) // 2
                 src = src.resize(resized, Image.ANTIALIAS)
                 src = src.crop((0, cut, src.size[0], src.size[1] - cut))
             else:
@@ -733,6 +737,7 @@ class LegimiCover(LogoWLCover):
     ]
     logos_right = False
     gradient_logo_centering = True
+    background_top = True
 
     genre_colors = {
         'Artykuł': '#bf001a',
index 8adde33..c00785a 100644 (file)
@@ -115,7 +115,7 @@ class WLDocument(object):
             else:
                 data['parts'].append((part, part.get_statistics()))
                 for k, v in data['parts'][-1][1]['total'].items():
-                    data['total'][k] += v
+                    data['total'][k] = data['total'].get(k, 0) + v
             
         return data