From c80e517c2865ca967ea7026e132e1c9d86437513 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sat, 15 Apr 2017 18:24:48 +0200 Subject: [PATCH] Delete books prepared for deleting on doogle drive --- cps/helper.py | 3 +++ cps/web.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cps/helper.py b/cps/helper.py index 4c9606c5..4c52def8 100755 --- a/cps/helper.py +++ b/cps/helper.py @@ -277,6 +277,9 @@ def delete_book(book, calibrepath): path = os.path.join(calibrepath, book.path)#.replace('/',os.path.sep)).replace('\\',os.path.sep) shutil.rmtree(path, ignore_errors=True) +def delete_book_gdrive(book): + pass + def update_dir_stucture(book_id, calibrepath): db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort) book = db.session.query(db.Books).filter(db.Books.id == book_id).first() diff --git a/cps/web.py b/cps/web.py index b1495582..cd9d9386 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1290,7 +1290,10 @@ def delete_book(book_id): if current_user.role_delete_books(): book = db.session.query(db.Books).filter(db.Books.id == book_id).first() if book: - helper.delete_book(book,config.config_calibre_dir) + if config.config_use_google_drive: + helper.delete_book_gdrive(book) # ToDo really delete file + else: + helper.delete_book(book,config.config_calibre_dir) # check if only this book links to: # author, language, series, tags, custom columns modify_database_object([u''], book.authors, db.Authors, db.session, 'author')