diff --git a/cps/gdrive.py b/cps/gdrive.py index 6ca73ca9..e782cb9e 100644 --- a/cps/gdrive.py +++ b/cps/gdrive.py @@ -109,7 +109,7 @@ def revoke_watch_gdrive(): try: gdriveutils.stopChannel(gdriveutils.Gdrive.Instance().drive, last_watch_response['id'], last_watch_response['resourceId']) - except HttpError: + except (HttpError, AttributeError): pass config.config_google_drive_watch_changes_response = {} config.save() diff --git a/cps/gdriveutils.py b/cps/gdriveutils.py index 878c1f9f..c4445944 100644 --- a/cps/gdriveutils.py +++ b/cps/gdriveutils.py @@ -56,11 +56,13 @@ try: from pydrive2.auth import GoogleAuth from pydrive2.drive import GoogleDrive from pydrive2.auth import RefreshError + from pydrive2.files import ApiRequestError except ImportError as err: try: from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from pydrive.auth import RefreshError + from pydrive.files import ApiRequestError except ImportError as err: importError = err gdrive_support = False @@ -322,6 +324,11 @@ def getFolderId(path, drive): log.error("gdrive.db DB is not Writeable") log.debug('Database error: %s', ex) session.rollback() + except ApiRequestError as ex: + log.error('{} {}'.format(ex.error['message'], path)) + session.rollback() + except RefreshError as ex: + log.error(ex) return currentFolderId diff --git a/cps/helper.py b/cps/helper.py index e4305550..b8499a12 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -673,9 +673,9 @@ def save_cover(img, book_path): def do_download_file(book, book_format, client, data, headers): if config.config_use_google_drive: - startTime = time.time() + #startTime = time.time() df = gd.getFileFromEbooksFolder(book.path, data.name + "." + book_format) - log.debug('%s', time.time() - startTime) + #log.debug('%s', time.time() - startTime) if df: return gd.do_gdrive_download(df, headers) else: