mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-06 11:35:49 +00:00
parent
f8edb63486
commit
b387995f4d
20
make_book.py
20
make_book.py
@ -146,7 +146,25 @@ class BEPUB:
|
||||
self.epub_name = epub_name
|
||||
self.new_epub = epub.EpubBook()
|
||||
self.translate_model = model(key, language, model_api_base)
|
||||
self.origin_book = epub.read_epub(self.epub_name)
|
||||
|
||||
try:
|
||||
self.origin_book = epub.read_epub(self.epub_name)
|
||||
except:
|
||||
# tricky for #71 if you don't know why please check the issue and ignore this
|
||||
# when upstream change will TODO fix this
|
||||
def _load_spine(self):
|
||||
spine = self.container.find(
|
||||
"{%s}%s" % (epub.NAMESPACES["OPF"], "spine")
|
||||
)
|
||||
|
||||
self.book.spine = [
|
||||
(t.get("idref"), t.get("linear", "yes")) for t in spine
|
||||
]
|
||||
self.book.set_direction(spine.get("page-progression-direction", None))
|
||||
|
||||
epub.EpubReader._load_spine = _load_spine
|
||||
self.origin_book = epub.read_epub(self.epub_name)
|
||||
|
||||
self.p_to_save = []
|
||||
self.resume = resume
|
||||
self.bin_path = f"{Path(epub_name).parent}/.{Path(epub_name).stem}.temp.bin"
|
||||
|
Loading…
x
Reference in New Issue
Block a user