Download preset on condition

This commit is contained in:
Kibzik
2023-03-16 16:58:23 +03:00
parent da6e05064d
commit e0e9b89cb3
2 changed files with 13 additions and 9 deletions

View File

@@ -18,9 +18,9 @@ from src.epub_converter.epub_solver import EpubBook
def local_convert_book(book_type: [DocxBook, EpubBook], book_id: int, main_logger: logging.Logger, params: dict):
main_logger.info(f"Start processing book-{book_id}.")
try:
json_file_path = "books/json/9781614382264.json"
json_file_path = "books/json/9781264269044.json"
book = book_type(book_id=book_id, main_logger=main_logger, **params)
book.conversion(json_file_path)
book.conversion_local(json_file_path)
except Exception as exc:
raise exc
main_logger.info(f"Book-{book_id} has been proceeded.")
@@ -59,6 +59,7 @@ def callback(ch, method, properties, body: bytes, main_logger: logging.Logger, l
}
thread = Thread(target=convert_book, kwargs=params)
# thread = Thread(target=local_convert_book, kwargs=params)
thread.start()
logging.log(logging.INFO, f"Active threads: {active_count()}.")
# print(f"Active threads: {active_count()}.")