|
|
|
@ -52,7 +52,7 @@ class _Settings(_Base):
|
|
|
|
|
config_random_books = Column(Integer, default=4)
|
|
|
|
|
config_authors_max = Column(Integer, default=0)
|
|
|
|
|
config_read_column = Column(Integer, default=0)
|
|
|
|
|
config_title_regex = Column(String, default=u'^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+')
|
|
|
|
|
config_title_regex = Column(String, default=r'^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+')
|
|
|
|
|
config_log_level = Column(SmallInteger, default=logger.DEFAULT_LOG_LEVEL)
|
|
|
|
|
config_access_log = Column(SmallInteger, default=0)
|
|
|
|
|
config_uploading = Column(SmallInteger, default=0)
|
|
|
|
@ -106,7 +106,6 @@ class _Settings(_Base):
|
|
|
|
|
|
|
|
|
|
# Class holds all application specific settings in calibre-web
|
|
|
|
|
class _ConfigSQL(object):
|
|
|
|
|
# pylint: disable=no-member
|
|
|
|
|
def __init__(self, session):
|
|
|
|
|
self._session = session
|
|
|
|
|
self._settings = None
|
|
|
|
@ -226,8 +225,14 @@ class _ConfigSQL(object):
|
|
|
|
|
|
|
|
|
|
if self.config_google_drive_watch_changes_response:
|
|
|
|
|
self.config_google_drive_watch_changes_response = json.loads(self.config_google_drive_watch_changes_response)
|
|
|
|
|
self.db_configured = (self.config_calibre_dir and
|
|
|
|
|
(not self.config_use_google_drive or os.path.exists(self.config_calibre_dir + '/metadata.db')))
|
|
|
|
|
|
|
|
|
|
have_metadata_db = bool(self.config_calibre_dir)
|
|
|
|
|
if have_metadata_db:
|
|
|
|
|
if not self.config_use_google_drive:
|
|
|
|
|
db_file = os.path.join(self.config_calibre_dir, 'metadata.db')
|
|
|
|
|
have_metadata_db = os.path.isfile(db_file)
|
|
|
|
|
self.db_configured = have_metadata_db
|
|
|
|
|
|
|
|
|
|
logger.setup(self.config_logfile, self.config_log_level)
|
|
|
|
|
|
|
|
|
|
def save(self):
|
|
|
|
@ -264,6 +269,7 @@ def _migrate_table(session, orm_class):
|
|
|
|
|
log.debug("%s: %s", column_name, err)
|
|
|
|
|
column_default = "" if column.default is None else ("DEFAULT %r" % column.default.arg)
|
|
|
|
|
alter_table = "ALTER TABLE %s ADD COLUMN `%s` %s %s" % (orm_class.__tablename__, column_name, column.type, column_default)
|
|
|
|
|
log.debug(alter_table)
|
|
|
|
|
session.execute(alter_table)
|
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|