mirror of
https://github.com/janeczku/calibre-web
synced 2024-10-31 23:26:20 +00:00
More fixes for googledrive
This commit is contained in:
parent
e308a74dc2
commit
86fe970651
@ -170,6 +170,9 @@ def update_view_configuration():
|
|||||||
_config_int("config_books_per_page")
|
_config_int("config_books_per_page")
|
||||||
_config_int("config_authors_max")
|
_config_int("config_authors_max")
|
||||||
|
|
||||||
|
if config.config_google_drive_watch_changes_response:
|
||||||
|
config.config_google_drive_watch_changes_response = json.dumps(config.config_google_drive_watch_changes_response)
|
||||||
|
|
||||||
config.config_default_role = constants.selected_roles(to_save)
|
config.config_default_role = constants.selected_roles(to_save)
|
||||||
config.config_default_role &= ~constants.ROLE_ANONYMOUS
|
config.config_default_role &= ~constants.ROLE_ANONYMOUS
|
||||||
|
|
||||||
@ -258,6 +261,7 @@ def _configuration_update_helper():
|
|||||||
db_change = False
|
db_change = False
|
||||||
to_save = request.form.to_dict()
|
to_save = request.form.to_dict()
|
||||||
|
|
||||||
|
# _config_dict = lambda x: config.set_from_dictionary(to_save, x, lambda y: y['id'])
|
||||||
_config_string = lambda x: config.set_from_dictionary(to_save, x, lambda y: y.strip() if y else y)
|
_config_string = lambda x: config.set_from_dictionary(to_save, x, lambda y: y.strip() if y else y)
|
||||||
_config_int = lambda x: config.set_from_dictionary(to_save, x, int)
|
_config_int = lambda x: config.set_from_dictionary(to_save, x, int)
|
||||||
_config_checkbox = lambda x: config.set_from_dictionary(to_save, x, lambda y: y == "on", False)
|
_config_checkbox = lambda x: config.set_from_dictionary(to_save, x, lambda y: y == "on", False)
|
||||||
@ -415,7 +419,8 @@ def _configuration_result(error_flash=None, gdriveError=None):
|
|||||||
if gdriveError:
|
if gdriveError:
|
||||||
gdriveError = _(gdriveError)
|
gdriveError = _(gdriveError)
|
||||||
else:
|
else:
|
||||||
if config.config_use_google_drive and not gdrive_authenticate:
|
# if config.config_use_google_drive and\
|
||||||
|
if not gdrive_authenticate:
|
||||||
gdrivefolders = gdriveutils.listRootFolders()
|
gdrivefolders = gdriveutils.listRootFolders()
|
||||||
|
|
||||||
show_back_button = current_user.is_authenticated
|
show_back_button = current_user.is_authenticated
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
from __future__ import division, print_function, unicode_literals
|
from __future__ import division, print_function, unicode_literals
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -141,7 +142,10 @@ def on_received_watch_confirmation():
|
|||||||
response = gdriveutils.getChangeById(gdriveutils.Gdrive.Instance().drive, j['id'])
|
response = gdriveutils.getChangeById(gdriveutils.Gdrive.Instance().drive, j['id'])
|
||||||
log.debug('%r', response)
|
log.debug('%r', response)
|
||||||
if response:
|
if response:
|
||||||
|
if sys.version_info < (3, 0):
|
||||||
dbpath = os.path.join(config.config_calibre_dir, "metadata.db")
|
dbpath = os.path.join(config.config_calibre_dir, "metadata.db")
|
||||||
|
else:
|
||||||
|
dbpath = os.path.join(config.config_calibre_dir, "metadata.db").encode()
|
||||||
if not response['deleted'] and response['file']['title'] == 'metadata.db' and response['file']['md5Checksum'] != hashlib.md5(dbpath):
|
if not response['deleted'] and response['file']['title'] == 'metadata.db' and response['file']['md5Checksum'] != hashlib.md5(dbpath):
|
||||||
tmpDir = tempfile.gettempdir()
|
tmpDir = tempfile.gettempdir()
|
||||||
log.info('Database file updated')
|
log.info('Database file updated')
|
||||||
|
@ -47,6 +47,10 @@ CREDENTIALS = os.path.join(_CONFIG_DIR, 'gdrive_credentials')
|
|||||||
CLIENT_SECRETS = os.path.join(_CONFIG_DIR, 'client_secrets.json')
|
CLIENT_SECRETS = os.path.join(_CONFIG_DIR, 'client_secrets.json')
|
||||||
|
|
||||||
log = logger.create()
|
log = logger.create()
|
||||||
|
if gdrive_support:
|
||||||
|
logger.get('googleapiclient.discovery_cache').setLevel(logger.logging.ERROR)
|
||||||
|
if not logger.is_debug_enabled():
|
||||||
|
logger.get('googleapiclient.discovery').setLevel(logger.logging.ERROR)
|
||||||
|
|
||||||
|
|
||||||
class Singleton:
|
class Singleton:
|
||||||
|
Loading…
Reference in New Issue
Block a user