Improve EPUB parser compatibility and speed
Completely break MOBI parser
This commit is contained in:
@@ -63,5 +63,11 @@ class ParseEPUB:
|
||||
self.book_ref.generate_toc()
|
||||
self.book_ref.generate_content()
|
||||
|
||||
toc = []
|
||||
content = []
|
||||
for count, i in enumerate(self.book['content']):
|
||||
toc.append((i[0], i[1], count + 1))
|
||||
content.append(i[2])
|
||||
|
||||
# Return toc, content, images_only
|
||||
return self.book['toc'], self.book['content'], False
|
||||
return toc, content, False
|
||||
|
@@ -55,10 +55,10 @@ class ParseMOBI:
|
||||
self.epub_filepath = shutil.make_archive(zip_file, 'zip', zip_dir)
|
||||
self.split_large_xml = True
|
||||
|
||||
self.book_ref = EPUB(self.epub_filepath)
|
||||
contents_found = self.book_ref.read_epub()
|
||||
if not contents_found:
|
||||
return False
|
||||
self.book_ref = EPUB(self.epub_filepath, self.temp_dir)
|
||||
self.book_ref.generate_metadata()
|
||||
self.book_ref.generate_toc()
|
||||
self.book_ref.generate_content()
|
||||
self.book = self.book_ref.book
|
||||
return True
|
||||
|
||||
@@ -81,6 +81,7 @@ class ParseMOBI:
|
||||
return self.book['tags']
|
||||
|
||||
def get_contents(self):
|
||||
return
|
||||
extract_path = os.path.join(self.extract_dir)
|
||||
zipfile.ZipFile(self.epub_filepath).extractall(extract_path)
|
||||
|
||||
|
Reference in New Issue
Block a user