update librarian, new mobi
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 23 Dec 2021 12:07:10 +0000 (13:07 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 23 Dec 2021 12:07:10 +0000 (13:07 +0100)
requirements/requirements.txt
src/catalogue/fields.py

index 9fa7b7c..62bad53 100644 (file)
@@ -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
index 4c8a780..581bf38 100644 (file)
@@ -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')