setup(
name='librarian',
- version='2.5.1',
+ version='2.6',
description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
author="Marek Stępniowski",
author_email='marek@stepniowski.com',
from librarian.covers.marquise import MarquiseCover, LabelMarquiseCover
COVER_CLASSES = {
- 'default': LogoWLCover,
+ 'legacy': LogoWLCover,
'kmlu': KMLUCover,
'mpw': MPWCover,
'atrium': AtriumCover,
'factory': FactoryCover,
'm': MarquiseCover,
'm-label': LabelMarquiseCover,
+ 'default': MarquiseCover,
}
def find_grouping(self, groups, ngroups, glue):
best = None
best_var = None
+ if not groups:
+ return []
mean = sum(g[0] for g in groups) + (len(groups) - ngroups) * glue
if mean > self.width * ngroups:
authors = [a.readable() for a in self.cover.book_info.authors]
translators = [a.readable() for a in self.cover.book_info.translators]
+ self.textboxes = []
if authors and translators:
# Try with two boxes.
self.textboxes = [author_box]
- self.margin_top = self.textboxes[0].margin_top
+ if self.textboxes:
+ self.margin_top = self.textboxes[0].margin_top
def build(self, w, h):
img = PIL.Image.new('RGBA', (self.width, self.m.leading * 2))
transparency = False
def setup(self):
+ self.img = None
if self.cover.book_info.cover_url:
while True:
try:
self.img = img
def build(self, w, h):
+ if not self.img:
+ return
kwadrat = round(max(w, h))
img = self.img
img = self.img.resize((kwadrat, kwadrat))
def apply(self, img, x, y, w=None, h=None):
my_img = self.build(w, h)
- img.paste(
- my_img,
- (round(x), round(y - self.margin_top)),
- my_img if self.transparency else None
- )
+ if my_img is not None:
+ img.paste(
+ my_img,
+ (round(x), round(y - self.margin_top)),
+ my_img if self.transparency else None
+ )