cleanup of `autodetect_converter_binary`

This commit is contained in:
Thore Schillmann 2022-07-01 12:06:33 +00:00
parent a77aef83c6
commit 0d34f41a48
1 changed files with 3 additions and 7 deletions

View File

@ -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 ""