-@BuildEbook.register('cover_thumb')
-@task(ignore_result=True)
-class BuildCoverThumb(BuildEbook):
- @classmethod
- def transform(cls, wldoc, fieldfile):
+ @staticmethod
+ def transform(wldoc, book):
+ from librarian.builders.html import HtmlBuilder
+ url = wldoc.meta.url
+ if not url:
+ gal_url = ''
+ gal_path = ''
+ else:
+ gal_url = gallery_url(slug=url.slug)
+ gal_path = gallery_path(slug=url.slug)
+ return HtmlBuilder(gallery_path=gal_path, gallery_url=gal_url, base_url=absolute_url(gal_url)).build(wldoc)
+
+
+class CoverField(EbookField):
+ ext = 'jpg'
+ directory = 'cover'
+
+ @staticmethod
+ def transform(wldoc, book):
+ return get_make_cover(book)(wldoc.book_info, width=360).output_file()
+
+ def set_file_permissions(self, fieldfile):
+ pass
+
+
+class CoverCleanField(CoverField):
+ directory = 'cover_clean'
+
+ @staticmethod
+ def transform(wldoc, book):
+ return get_make_cover(book)(wldoc.book_info, width=360).output_file()
+
+
+class CoverThumbField(CoverField):
+ directory = 'cover_thumb'
+
+ @staticmethod
+ def transform(wldoc, book):