Bugfix Get gdrive instances (#554, #525)

Metadata.db download works again
removed DEVELOPMENT constant
removed db logging in debug mode (too, noisy, to less information)
code refactoring url_for_other_page
feed languge set to en-EN
update status shos local time instead of UTC
Error handling (back to index page) in case of gdrive authenticate aborted
Mistyping page register fixed
Mistyping bokk fixed
Added uploaded books to tasklist (#442)
Error handling for failed file update added
Code refactoring worker thread
Tasks now never show any decimal values
Converter function unified
removed shell from subprocess call
preparation for limiting domain for registering emails
Book series can now increased in 0.1 steps (#562)
Accordion panels in config are now usable on touch devices like iPad (#545)
Gdrive authenticate button only visible after logged in (#525)
Fixed misstyping in german translation
This commit is contained in:
OzzieIsaacs
2018-08-16 21:17:26 +02:00
parent f8132f4d02
commit cdb1b52652
10 changed files with 243 additions and 174 deletions

View File

@@ -3,8 +3,9 @@ try:
from pydrive.drive import GoogleDrive
from pydrive.auth import RefreshError
from apiclient import errors
gdrive_support = True
except ImportError:
pass
gdrive_support = False
import os
from ub import config
@@ -259,6 +260,13 @@ def copyDriveFileRemote(drive, origin_file_id, copy_title):
print ('An error occurred: %s' % error)
return None
# Download metadata.db from gdrive
def downloadFile(path, filename, output):
f = getFileFromEbooksFolder(path, filename)
f.GetContentFile(output)
def moveGdriveFolderRemote(origin_file, target_folder):
drive = getDrive(Gdrive.Instance().drive)
previous_parents = ",".join([parent["id"] for parent in origin_file.get('parents')])
@@ -339,7 +347,7 @@ def uploadFileToEbooksFolder(destFile, f):
def watchChange(drive, channel_id, channel_type, channel_address,
channel_token=None, expiration=None):
drive = getDrive(drive)
# drive = getDrive(drive)
# Watch for all changes to a user's Drive.
# Args:
# service: Drive API service instance.
@@ -382,7 +390,7 @@ def watchFile(drive, file_id, channel_id, channel_type, channel_address,
Raises:
apiclient.errors.HttpError: if http request to create channel fails.
"""
drive = getDrive(drive)
# drive = getDrive(drive)
body = {
'id': channel_id,
@@ -405,7 +413,7 @@ def stopChannel(drive, channel_id, resource_id):
Raises:
apiclient.errors.HttpError: if http request to create channel fails.
"""
drive = getDrive(drive)
# drive = getDrive(drive)
# service=drive.auth.service
body = {
'id': channel_id,
@@ -415,7 +423,7 @@ def stopChannel(drive, channel_id, resource_id):
def getChangeById (drive, change_id):
drive = getDrive(drive)
# drive = getDrive(drive)
# Print a single Change resource information.
#
# Args: