Change logic of empty preset

This commit is contained in:
Kibzik
2023-03-28 14:51:44 +03:00
parent 54b97d01c5
commit eb1bd0ed2b

View File

@@ -81,12 +81,8 @@ class BookSolver:
content = self.access.get_file(
file_path=f"{self.access.url}/doc-convert/{self.book_id}/presets")
self.book_logger.log("\033[4mPreset\033[0m file was received from server.")
if len(content) > 3:
self.preset_path = pathlib.Path(
str(self.save_file(content, path_to_save="preset", file_type="json")))
else:
self.preset_path = "preset/docx_presets.json" if self.book_type == "docx" \
else "preset/epub_presets.json"
self.preset_path = pathlib.Path(
str(self.save_file(content, path_to_save="preset", file_type="json")))
except FileNotFoundError as f_err:
self.book_logger.log(
"Can't get preset file from server.", logging.ERROR)