mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 18:47:23 +00:00
Update for running calibre-convert in docker
This commit is contained in:
parent
7917347508
commit
72fff2a297
@ -233,15 +233,23 @@ class WorkerThread(threading.Thread):
|
|||||||
if web.ub.config.config_ebookconverter == 1:
|
if web.ub.config.config_ebookconverter == 1:
|
||||||
command = [web.ub.config.config_converterpath, u'"' + file_path + u'.epub"']
|
command = [web.ub.config.config_converterpath, u'"' + file_path + u'.epub"']
|
||||||
else:
|
else:
|
||||||
command = [web.ub.config.config_converterpath, '"' + file_path + u'.epub"',
|
# Linux py2.7 encode as list without quotes no empty element for parameters
|
||||||
'"'+file_path + u'.mobi"']
|
# linux py3.x no encode and as list without quotes no empty element for parameters
|
||||||
if web.ub.config.config_calibre:
|
# windows py2.7 encode as string with qoutes empty element for parameters is okay
|
||||||
command.append(web.ub.config.config_calibre)
|
# windows py 3.x no encode and as string with qoutes empty element for parameters is okay
|
||||||
# special handling for windows
|
# seperate handling for windows and linux
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
command = ' '.join(command)
|
command = web.ub.config.config_converterpath + u' "' + file_path + u'.epub" "' + \
|
||||||
if sys.version_info < (3, 0):
|
file_path + u'.mobi" ' + web.ub.config.config_calibre
|
||||||
command = command.encode(sys.getfilesystemencoding())
|
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)
|
p = subprocess.Popen(command, stdout=subprocess.PIPE, universal_newlines=True)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user