Preset support

This commit is contained in:
Kibzik
2023-03-15 12:56:51 +03:00
parent fc6fb4a625
commit 8e8c23d071
4 changed files with 19 additions and 22 deletions

View File

@@ -34,10 +34,10 @@ class EpubBook(BookSolver):
style_preprocessor = StyleReader()
# Parses and cleans html, gets list of tags, gets footnotes
try:
html_preprocessor = HtmlPresetsProcessor(
logger=self.book_logger, preset_path="preset/epub_presets.json")
html_preset_processor = HtmlPresetsProcessor(
logger=self.book_logger, preset_path=self.preset_path)
html_processor = HtmlEpubProcessor(logger=self.book_logger,
html_preprocessor=html_preprocessor)
html_preprocessor=html_preset_processor)
except Exception as exc:
self.book_logger.log(
"Error has occurred while processing .html", logging.ERROR)
@@ -52,17 +52,16 @@ class EpubBook(BookSolver):
if __name__ == "__main__":
epub_file_path = f"../../books/epub/Deep_Learning_with_Python_Second_Editio.epub"
epub_file_path = f"../../books/epub/9781260455076.epub"
logger_object = BookLogger(name="epub")
logger_object.configure_book_logger(book_id=epub_file_path.split("/")[-1])
html_preprocessor = HtmlPresetsProcessor(
html_preset_processor = HtmlPresetsProcessor(
logger=logger_object, preset_path="../../preset/epub_presets.json")
style_preprocessor = StyleReader()
html_processor = HtmlEpubProcessor(logger=logger_object,
html_preprocessor=html_preprocessor)
html_preprocessor=html_preset_processor)
json_converter = EpubConverter(epub_file_path, logger=logger_object,
style_processor=style_preprocessor, html_processor=html_processor)