1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Update for running calibre-convert in docker

This commit is contained in:
OzzieIsaacs 2018-08-22 21:24:28 +02:00
parent 7917347508
commit 72fff2a297

View File

@ -233,15 +233,23 @@ class WorkerThread(threading.Thread):
if web.ub.config.config_ebookconverter == 1:
command = [web.ub.config.config_converterpath, u'"' + file_path + u'.epub"']
else:
command = [web.ub.config.config_converterpath, '"' + file_path + u'.epub"',
'"'+file_path + u'.mobi"']
if web.ub.config.config_calibre:
command.append(web.ub.config.config_calibre)
# special handling for windows
# Linux py2.7 encode as list without quotes no empty element for parameters
# linux py3.x no encode and as list without quotes no empty element for parameters
# windows py2.7 encode as string with qoutes empty element for parameters is okay
# windows py 3.x no encode and as string with qoutes empty element for parameters is okay
# seperate handling for windows and linux
if os.name == 'nt':
command = ' '.join(command)
command = web.ub.config.config_converterpath + u' "' + file_path + u'.epub" "' + \
file_path + u'.mobi" ' + web.ub.config.config_calibre
if sys.version_info < (3, 0):
command = command.encode(sys.getfilesystemencoding())
else:
command = [web.ub.config.config_converterpath, (file_path + u'.epub'),
(file_path + u'.mobi')]
if web.ub.config.config_calibre:
command.append(web.ub.config.config_calibre)
if sys.version_info < (3, 0):
command = [ x.encode(sys.getfilesystemencoding()) for x in command ]
p = subprocess.Popen(command, stdout=subprocess.PIPE, universal_newlines=True)
except OSError as e: