mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-18 06:00:32 +00:00
Fix for #3131 (Enable/Disable "Separate Book Files from Library" issue)
This commit is contained in:
parent
5e9dfc0724
commit
481237dc77
@ -1716,6 +1716,13 @@ def _db_configuration_update_helper():
|
|||||||
db_change = True
|
db_change = True
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
return _db_configuration_result('{}'.format(ex), gdrive_error)
|
return _db_configuration_result('{}'.format(ex), gdrive_error)
|
||||||
|
config.config_calibre_split = to_save.get('config_calibre_split', 0) == "on"
|
||||||
|
if config.config_calibre_split:
|
||||||
|
split_dir = to_save.get("config_calibre_split_dir")
|
||||||
|
if not os.path.exists(split_dir):
|
||||||
|
return _db_configuration_result(_("Books path not valid"), gdrive_error)
|
||||||
|
else:
|
||||||
|
_config_string(to_save, "config_calibre_split_dir")
|
||||||
|
|
||||||
if db_change or not db_valid or not config.db_configured \
|
if db_change or not db_valid or not config.db_configured \
|
||||||
or config.config_calibre_dir != to_save["config_calibre_dir"]:
|
or config.config_calibre_dir != to_save["config_calibre_dir"]:
|
||||||
@ -1741,8 +1748,6 @@ def _db_configuration_update_helper():
|
|||||||
calibre_db.update_config(config)
|
calibre_db.update_config(config)
|
||||||
if not os.access(os.path.join(config.config_calibre_dir, "metadata.db"), os.W_OK):
|
if not os.access(os.path.join(config.config_calibre_dir, "metadata.db"), os.W_OK):
|
||||||
flash(_("DB is not Writeable"), category="warning")
|
flash(_("DB is not Writeable"), category="warning")
|
||||||
_config_string(to_save, "config_calibre_split_dir")
|
|
||||||
config.config_calibre_split = to_save.get('config_calibre_split', 0) == "on"
|
|
||||||
calibre_db.update_config(config)
|
calibre_db.update_config(config)
|
||||||
config.save()
|
config.save()
|
||||||
return _db_configuration_result(None, gdrive_error)
|
return _db_configuration_result(None, gdrive_error)
|
||||||
|
@ -182,26 +182,6 @@ class _Settings(_Base):
|
|||||||
class ConfigSQL(object):
|
class ConfigSQL(object):
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
'''self.config_calibre_uuid = None
|
|
||||||
self.config_calibre_split_dir = None
|
|
||||||
self.dirty = None
|
|
||||||
self.config_logfile = None
|
|
||||||
self.config_upload_formats = None
|
|
||||||
self.mail_gmail_token = None
|
|
||||||
self.mail_server_type = None
|
|
||||||
self.mail_server = None
|
|
||||||
self.config_log_level = None
|
|
||||||
self.config_allowed_column_value = None
|
|
||||||
self.config_denied_column_value = None
|
|
||||||
self.config_allowed_tags = None
|
|
||||||
self.config_denied_tags = None
|
|
||||||
self.config_default_show = None
|
|
||||||
self.config_default_role = None
|
|
||||||
self.config_keyfile = None
|
|
||||||
self.config_certfile = None
|
|
||||||
self.config_rarfile_location = None
|
|
||||||
self.config_kepubifypath = None
|
|
||||||
self.config_binariesdir = None'''
|
|
||||||
self.__dict__["dirty"] = list()
|
self.__dict__["dirty"] = list()
|
||||||
|
|
||||||
def init_config(self, session, secret_key, cli):
|
def init_config(self, session, secret_key, cli):
|
||||||
|
@ -35,9 +35,7 @@ def do_calibre_export(book_id, book_format):
|
|||||||
my_env = os.environ.copy()
|
my_env = os.environ.copy()
|
||||||
if config.config_calibre_split:
|
if config.config_calibre_split:
|
||||||
my_env['CALIBRE_OVERRIDE_DATABASE_PATH'] = os.path.join(config.config_calibre_dir, "metadata.db")
|
my_env['CALIBRE_OVERRIDE_DATABASE_PATH'] = os.path.join(config.config_calibre_dir, "metadata.db")
|
||||||
library_path = config.config_calibre_split_dir
|
library_path = config.get_book_path()
|
||||||
else:
|
|
||||||
library_path = config.config_calibre_dir
|
|
||||||
opf_command = [calibredb_binarypath, 'export', '--dont-write-opf', '--with-library', library_path,
|
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)]
|
||||||
|
Loading…
Reference in New Issue
Block a user