Delete temporary files

This commit is contained in:
Kiryl
2022-07-28 13:03:32 +03:00
parent 009b755a31
commit ea13d38f27

View File

@@ -57,7 +57,7 @@ class BookSolver:
with open(file_path, "wb+") as file:
file.write(content)
self.logger_object.log(
f"Preset file was saved to folder: {folder_path}.")
f"File was saved to folder: {folder_path}.")
except Exception as exc:
self.logger_object.log(
f"Error in writing {self.book_type} file.", logging.ERROR)
@@ -153,12 +153,14 @@ class BookSolver:
"""
try:
self.logger_object.log(
f"Beginning of conversion from .{self.book_type} to .json.")
self.get_preset_file()
self.get_book_file()
self.logger_object.log(
f"Beginning of conversion from .{self.book_type} to .json.")
self.status_wrapper.set_processing()
content_dict = self.get_converted_book()
[os.remove(path) for path in [self.preset_path, self.book_path]]
self.logger_object.log("Beginning of processing .json output.")
self.status_wrapper.set_generating()
self.write_to_json(content_dict)
self.send_json_content_to_server(content_dict)
@@ -184,6 +186,7 @@ class BookSolver:
self.status_wrapper.set_processing()
with codecs.open(file_path, "r", encoding="utf-8") as f_json:
content_dict = json.load(f_json)
self.logger_object.log("Beginning of processing .json output.")
self.status_wrapper.set_generating()
self.send_json_content_to_server(content_dict)
self.logger_object.log(f"Sent a file to server. Check LiveCarta.")