X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/deabe6b4d1a81b2f553526a6172227dd00fe8817..dd79289baf8168c654faaaa5c8e5840e3a63f94e:/src/depot/legimi.py?ds=sidebyside diff --git a/src/depot/legimi.py b/src/depot/legimi.py index 99f70624..86ad6e52 100644 --- a/src/depot/legimi.py +++ b/src/depot/legimi.py @@ -168,20 +168,21 @@ class Legimi: "url": model['Url'], } -# name=files[] -# filename -# content-type -# response: json -# success: true -# model.Url - - def send_book(self, book): - wlbook = book.wldocument(librarian2=True) + def send_book(self, book, changes=None): + wlbook = book.wldocument(librarian2=True, changes=changes) meta = wlbook.meta cover = LabelMarquiseCover(meta, width=1200).output_file() - epub_file = EpubBuilder(cover=MarquiseCover, fundraising=fundraising).build(wlbook).get_file() - mobi_file = MobiBuilder(cover=MarquiseCover, fundraising=fundraising).build(wlbook).get_file() + epub_file = EpubBuilder( + cover=MarquiseCover, + fundraising=fundraising, + base_url='file://' + book.gallery_path() + '/' + ).build(wlbook).get_file() + mobi_file = MobiBuilder( + cover=MarquiseCover, + fundraising=fundraising, + base_url='file://' + book.gallery_path() + '/' + ).build(wlbook).get_file() book_data = { "Title": meta.title, @@ -196,7 +197,7 @@ class Legimi: } if meta.isbn_html: isbn = meta.isbn_html - if isbn.upper().startswith('ISBN '): + if isbn.upper().startswith(('ISBN ', 'ISBN-')): isbn = isbn[5:] isbn = isbn.strip() book_data['Isbn'] = isbn