forked from LiveCarta/BookConverter
epub converter: prettify
This commit is contained in:
@@ -5,6 +5,7 @@ import re
|
||||
from os.path import dirname, normpath, join
|
||||
from collections import defaultdict
|
||||
from typing import Dict, Union
|
||||
from itertools import chain
|
||||
|
||||
import ebooklib
|
||||
from bs4 import BeautifulSoup
|
||||
@@ -29,12 +30,8 @@ class EpubPostprocessor:
|
||||
self.logger.log('Image processing.')
|
||||
self.href2img_bytes = {}
|
||||
self.old_image_path2_aws_path = {}
|
||||
for x in self.ebooklib_book.get_items_of_type(ebooklib.ITEM_IMAGE):
|
||||
file_name = x.file_name
|
||||
content = x.content
|
||||
# todo: check how file path is count in lib
|
||||
self.href2img_bytes[file_name] = content
|
||||
for x in self.ebooklib_book.get_items_of_type(ebooklib.ITEM_COVER):
|
||||
for x in chain(self.ebooklib_book.get_items_of_type(ebooklib.ITEM_IMAGE),
|
||||
self.ebooklib_book.get_items_of_type(ebooklib.ITEM_COVER)):
|
||||
file_name = x.file_name
|
||||
content = x.content
|
||||
self.href2img_bytes[file_name] = content
|
||||
|
||||
Reference in New Issue
Block a user