From 413b10c58e5e599c66795828aeffe8164591e61b Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Mon, 9 Jul 2018 20:30:38 +0200 Subject: [PATCH] Bugfix gdrive Still open: gdrive.db entries aren't cleared upon change, gdrive.db is only working after restart if just enabled --- cps/helper.py | 7 ++++++- cps/web.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index cdc836d5..7eb3bd53 100755 --- a/cps/helper.py +++ b/cps/helper.py @@ -307,6 +307,7 @@ def get_sorted_author(value): def delete_book(book, calibrepath): + # check that path is 2 elements deep, check that target path has no subfolders if "/" in book.path: path = os.path.join(calibrepath, book.path) shutil.rmtree(path, ignore_errors=True) @@ -315,6 +316,10 @@ def delete_book(book, calibrepath): # ToDo: Implement delete book on gdrive def delete_book_gdrive(book): + # delete book and path of book in gdrive.db + # delete book and path of book on gdrive + #gFile = gd.getFileFromEbooksFolder(web.Gdrive.Instance().drive, os.path.dirname(book.path), titledir) + #gFile.Trash() pass @@ -366,7 +371,7 @@ def update_dir_structure_gdrive(book_id): new_titledir = get_valid_filename(book.title) + " (" + str(book_id) + ")" if titledir != new_titledir: - print (titledir) + # print (titledir) gFile = gd.getFileFromEbooksFolder(web.Gdrive.Instance().drive, os.path.dirname(book.path), titledir) gFile['title'] = new_titledir gFile.Upload() diff --git a/cps/web.py b/cps/web.py index 90a1e6fc..49977dad 100755 --- a/cps/web.py +++ b/cps/web.py @@ -2538,8 +2538,7 @@ def configuration_helper(origin): gdrive=gdrive_support, gdriveError=gdriveError, goodreads=goodreads_support, title=_(u"Basic Configuration")) # always show google drive settings, but in case of error deny support - if (("config_use_google_drive" in to_save and not content.config_use_google_drive) or - ("config_use_google_drive" not in to_save and content.config_use_google_drive)) and not gdriveError: + if "config_use_google_drive" in to_save and not gdriveError: content.config_use_google_drive = "config_use_google_drive" in to_save else: content.config_use_google_drive = 0