From 0d34f41a48e3056c0cd3c8bb0cc5882878481642 Mon Sep 17 00:00:00 2001 From: Thore Schillmann Date: Fri, 1 Jul 2022 12:06:33 +0000 Subject: [PATCH] cleanup of `autodetect_converter_binary` --- cps/config_sql.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cps/config_sql.py b/cps/config_sql.py index 9dc0abdd..7867b6f3 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -172,10 +172,7 @@ class _ConfigSQL(object): if self.config_binariesdir == None: # pylint: disable=access-member-before-definition change = True self.config_binariesdir = autodetect_calibre_binaries() - - if self.config_converterpath == None: # pylint: disable=access-member-before-definition - change = True - self.config_converterpath = autodetect_converter_binary() + self.config_converterpath = autodetect_converter_binary(self.config_binariesdir) if self.config_kepubifypath == None: # pylint: disable=access-member-before-definition change = True @@ -441,13 +438,12 @@ def autodetect_calibre_binaries(): return "" -def autodetect_converter_binary(): - calibre_path = autodetect_calibre_binaries() +def autodetect_converter_binary(calibre_path): if sys.platform == "win32": converter_path = os.path.join(calibre_path, "ebook-convert.exe") else: converter_path = os.path.join(calibre_path, "ebook-convert") - if os.path.isfile(converter_path) and os.access(converter_path, os.X_OK): + if calibre_path and os.path.isfile(converter_path) and os.access(converter_path, os.X_OK): return converter_path return ""