Added environment variables for reconnect
This commit is contained in:
parent
57cd8160a0
commit
034ab73ccc
@ -159,7 +159,7 @@ def shutdown():
|
||||
# needed for docker applications, as changes on metadata.db from host are not visible to application
|
||||
@admi.route("/reconnect", methods=['GET'])
|
||||
def reconnect():
|
||||
if cli.args.r:
|
||||
if cli.reconnect_enable:
|
||||
calibre_db.reconnect_db(config, ub.app_DB_path)
|
||||
return json.dumps({})
|
||||
else:
|
||||
|
@ -84,10 +84,14 @@ if args.k == "":
|
||||
|
||||
# dry run updater
|
||||
dry_run = args.d or None
|
||||
# enable reconnect endpoint for docker database reconnect
|
||||
reconnect_enable = args.r or os.environ.get("CALIBRE_RECONNECT", None)
|
||||
# load covers from localhost
|
||||
allow_localhost = args.l or None
|
||||
allow_localhost = args.l or os.environ.get("CALIBRE_LOCALHOST", None)
|
||||
# handle and check ip address argument
|
||||
ip_address = args.i or None
|
||||
|
||||
|
||||
if ip_address:
|
||||
try:
|
||||
# try to parse the given ip address with socket
|
||||
|
@ -81,7 +81,7 @@ if gdrive_support:
|
||||
if not logger.is_debug_enabled():
|
||||
logger.get('googleapiclient.discovery').setLevel(logger.logging.ERROR)
|
||||
else:
|
||||
log.debug("Cannot import pydrive,httplib2, using gdrive will not work: %s", importError)
|
||||
log.debug("Cannot import pydrive, httplib2, using gdrive will not work: %s", importError)
|
||||
|
||||
|
||||
class Singleton:
|
||||
@ -272,8 +272,7 @@ def getEbooksFolderId(drive=None):
|
||||
try:
|
||||
session.commit()
|
||||
except OperationalError as ex:
|
||||
log.error("gdrive.db DB is not Writeable")
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
session.rollback()
|
||||
return gDriveId.gdrive_id
|
||||
|
||||
@ -322,8 +321,7 @@ def getFolderId(path, drive):
|
||||
else:
|
||||
currentFolderId = storedPathName.gdrive_id
|
||||
except OperationalError as ex:
|
||||
log.error("gdrive.db DB is not Writeable")
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
session.rollback()
|
||||
except ApiRequestError as ex:
|
||||
log.error('{} {}'.format(ex.error['message'], path))
|
||||
@ -547,8 +545,7 @@ def deleteDatabaseOnChange():
|
||||
session.commit()
|
||||
except (OperationalError, InvalidRequestError) as ex:
|
||||
session.rollback()
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error(u"GDrive DB is not Writeable")
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
|
||||
|
||||
def updateGdriveCalibreFromLocal():
|
||||
@ -566,8 +563,7 @@ def updateDatabaseOnEdit(ID,newPath):
|
||||
try:
|
||||
session.commit()
|
||||
except OperationalError as ex:
|
||||
log.error("gdrive.db DB is not Writeable")
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
session.rollback()
|
||||
|
||||
|
||||
@ -577,8 +573,7 @@ def deleteDatabaseEntry(ID):
|
||||
try:
|
||||
session.commit()
|
||||
except OperationalError as ex:
|
||||
log.error("gdrive.db DB is not Writeable")
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
session.rollback()
|
||||
|
||||
|
||||
@ -599,8 +594,7 @@ def get_cover_via_gdrive(cover_path):
|
||||
try:
|
||||
session.commit()
|
||||
except OperationalError as ex:
|
||||
log.error("gdrive.db DB is not Writeable")
|
||||
log.debug('Database error: %s', ex)
|
||||
log.error_or_exception('Database error: %s', ex)
|
||||
session.rollback()
|
||||
return df.metadata.get('webContentLink')
|
||||
else:
|
||||
|
@ -435,8 +435,7 @@ def rename_all_authors(first_author, renamed_author, calibre_path="", localbook=
|
||||
new_author_path = os.path.join(calibre_path, new_author_rename_dir)
|
||||
shutil.move(os.path.normcase(old_author_path), os.path.normcase(new_author_path))
|
||||
except OSError as ex:
|
||||
log.error("Rename author from: %s to %s: %s", old_author_path, new_author_path, ex)
|
||||
log.debug(ex, exc_info=True)
|
||||
log.error_or_exception("Rename author from: %s to %s: %s", old_author_path, new_author_path, ex)
|
||||
return _("Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s",
|
||||
src=old_author_path, dest=new_author_path, error=str(ex))
|
||||
else:
|
||||
@ -550,8 +549,7 @@ def move_files_on_change(calibre_path, new_authordir, new_titledir, localbook, d
|
||||
# change location in database to new author/title path
|
||||
localbook.path = os.path.join(new_authordir, new_titledir).replace('\\', '/')
|
||||
except OSError as ex:
|
||||
log.error("Rename title from: %s to %s: %s", path, new_path, ex)
|
||||
log.debug(ex, exc_info=True)
|
||||
log.error_or_exception("Rename title from: %s to %s: %s", path, new_path, ex)
|
||||
return _("Rename title from: '%(src)s' to '%(dest)s' failed with error: %(error)s",
|
||||
src=path, dest=new_path, error=str(ex))
|
||||
return False
|
||||
@ -572,8 +570,7 @@ def rename_files_on_change(first_author,
|
||||
if not gdrive and not renamed_author and not orignal_filepath and len(os.listdir(os.path.dirname(path))) == 0:
|
||||
shutil.rmtree(os.path.dirname(path))
|
||||
except (OSError, FileNotFoundError) as ex:
|
||||
log.error("Error in rename file in path %s", ex)
|
||||
log.debug(ex, exc_info=True)
|
||||
log.error_or_exception("Error in rename file in path %s", ex)
|
||||
return _("Error in rename file in path: %(error)s", error=str(ex))
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user