From: Radek Czajka Date: Thu, 23 Dec 2021 12:07:10 +0000 (+0100) Subject: update librarian, new mobi X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d57cd71379f89196addaa90d1c14a17a359f35d3?ds=sidebyside;hp=1799a9fde9bb34e2c54e94eb0d15472dd53ca4e6 update librarian, new mobi --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 9fa7b7cc4..62bad5358 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -44,7 +44,7 @@ mutagen==1.45.1 sorl-thumbnail==12.7.0 # home-brewed & dependencies -librarian==2.2 +librarian==2.3.3 # celery tasks celery[redis]==4.4.7 diff --git a/src/catalogue/fields.py b/src/catalogue/fields.py index 4c8a780f0..581bf38a1 100644 --- a/src/catalogue/fields.py +++ b/src/catalogue/fields.py @@ -220,9 +220,15 @@ class BuildEpub(BuildEbook): @BuildEbook.register('mobi') @task(ignore_result=True) class BuildMobi(BuildEbook): + librarian2_api = True + @staticmethod def transform(wldoc, fieldfile): - return wldoc.as_mobi(cover=True, base_url=absolute_url(gallery_url(wldoc.book_info.url.slug))) + from librarian.builders import MobiBuilder + return MobiBuilder( + base_url='file://' + os.path.abspath(gallery_path(wldoc.meta.url.slug)) + '/', + fundraising=settings.EPUB_FUNDRAISING + ).build(wldoc) @BuildEbook.register('html')