From 7fd1d10fca3220329d6d762d3851486150e93405 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 11 Nov 2023 15:26:05 +0100 Subject: [PATCH] Implement gdrive metadata on download --- cps/helper.py | 9 +++++---- cps/updater.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index 013a6fc2..ab3123ec 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -942,10 +942,12 @@ def do_download_file(book, book_format, client, data, headers): df = gd.getFileFromEbooksFolder(book.path, book_name + "." + book_format) # log.debug('%s', time.time() - startTime) if df: - # ToDo check:!!!!!!!! if config.config_binariesdir: - output = os.path.join(config.config_calibre_dir, book.path, data.name) - gd.ownloadFile(book.path, book_name + "." + book_format, output) + output_path = os.path.join(config.config_calibre_dir, book.path) + if not os.path.exists(output_path): + os.makedirs(output_path) + output = os.path.join(config.config_calibre_dir, book.path, book_name + "." + book_format) + gd.downloadFile(book.path, book_name + "." + book_format, output) filename, download_name = do_calibre_export(book, book_format) else: return gd.do_gdrive_download(df, headers) @@ -973,7 +975,6 @@ def do_download_file(book, book_format, client, data, headers): return response - def do_calibre_export(book, book_format): try: quotes = [3, 5, 7, 9] diff --git a/cps/updater.py b/cps/updater.py index 4369e18f..8150aa0d 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -31,7 +31,7 @@ from flask_babel import format_datetime from flask_babel import gettext as _ from . import constants, logger # config, web_server -from .file_helper import gettempdir +from .file_helper import get_temp_dir log = logger.create()