|
|
@ -1007,10 +1007,17 @@ def do_calibre_export(book_id, book_format, ):
|
|
|
|
tmp_dir = get_temp_dir()
|
|
|
|
tmp_dir = get_temp_dir()
|
|
|
|
calibredb_binarypath = get_calibre_binarypath("calibredb")
|
|
|
|
calibredb_binarypath = get_calibre_binarypath("calibredb")
|
|
|
|
temp_file_name = str(uuid4())
|
|
|
|
temp_file_name = str(uuid4())
|
|
|
|
opf_command = [calibredb_binarypath, 'export', '--dont-write-opf', '--with-library', config.config_calibre_dir,
|
|
|
|
my_env = os.environ.copy()
|
|
|
|
|
|
|
|
if config.config_calibre_split:
|
|
|
|
|
|
|
|
my_env['CALIBRE_OVERRIDE_DATABASE_PATH'] = os.path.join(config.config_calibre_dir, "metadata.db")
|
|
|
|
|
|
|
|
library_path = config.config_calibre_split_dir
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
library_path = config.config_calibre_dir
|
|
|
|
|
|
|
|
opf_command = [calibredb_binarypath, 'export', '--dont-write-opf', '--with-library', library_path,
|
|
|
|
'--to-dir', tmp_dir, '--formats', book_format, "--template", "{}".format(temp_file_name),
|
|
|
|
'--to-dir', tmp_dir, '--formats', book_format, "--template", "{}".format(temp_file_name),
|
|
|
|
str(book_id)]
|
|
|
|
str(book_id)]
|
|
|
|
p = process_open(opf_command, quotes)
|
|
|
|
# CALIBRE_OVERRIDE_DATABASE_PATH
|
|
|
|
|
|
|
|
p = process_open(opf_command, quotes, my_env)
|
|
|
|
_, err = p.communicate()
|
|
|
|
_, err = p.communicate()
|
|
|
|
if err:
|
|
|
|
if err:
|
|
|
|
log.error('Metadata embedder encountered an error: %s', err)
|
|
|
|
log.error('Metadata embedder encountered an error: %s', err)
|
|
|
|