refactoring of calibre binary detection

This commit is contained in:
Thore Schillmann
2022-06-21 17:04:44 +00:00
parent 8c781ad4a4
commit 3c4330ba51
5 changed files with 60 additions and 13 deletions
+4 -3
View File
@@ -235,10 +235,11 @@ class TaskConvert(CalibreTask):
# separate handling for windows and linux
quotes = [1, 2]
# TODO: Clean up and make cli work with windows.
# TODO: Clean up.
# TODO: Maybe delete/clean-up tmp files directly.
tmp_dir = os.path.join(gettempdir(), 'calibre_web')
path_calibrecli = os.path.join(os.path.dirname(config.config_converterpath), "calibredb")
opf_command = [path_calibrecli, 'show_metadata', '--as-opf', str(book_id), '--with-library', config.config_calibre_dir]
calibredb_binarypath = config.get_calibre_binarypath("calibredb")
opf_command = [calibredb_binarypath, 'show_metadata', '--as-opf', str(book_id), '--with-library', config.config_calibre_dir]
p = process_open(opf_command)
path_tmp_opf = os.path.join(tmp_dir, "metadata_" + str(current_milli_time()) + ".opf")
with open(path_tmp_opf, 'w') as fd: