Implement gdrive metadata on download

This commit is contained in:
Ozzie Isaacs 2023-11-11 15:26:05 +01:00
parent cf6810db87
commit 7fd1d10fca
2 changed files with 6 additions and 5 deletions

View File

@ -942,10 +942,12 @@ def do_download_file(book, book_format, client, data, headers):
df = gd.getFileFromEbooksFolder(book.path, book_name + "." + book_format) df = gd.getFileFromEbooksFolder(book.path, book_name + "." + book_format)
# log.debug('%s', time.time() - startTime) # log.debug('%s', time.time() - startTime)
if df: if df:
# ToDo check:!!!!!!!!
if config.config_binariesdir: if config.config_binariesdir:
output = os.path.join(config.config_calibre_dir, book.path, data.name) output_path = os.path.join(config.config_calibre_dir, book.path)
gd.ownloadFile(book.path, book_name + "." + book_format, output) 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) filename, download_name = do_calibre_export(book, book_format)
else: else:
return gd.do_gdrive_download(df, headers) return gd.do_gdrive_download(df, headers)
@ -973,7 +975,6 @@ def do_download_file(book, book_format, client, data, headers):
return response return response
def do_calibre_export(book, book_format): def do_calibre_export(book, book_format):
try: try:
quotes = [3, 5, 7, 9] quotes = [3, 5, 7, 9]

View File

@ -31,7 +31,7 @@ from flask_babel import format_datetime
from flask_babel import gettext as _ from flask_babel import gettext as _
from . import constants, logger # config, web_server from . import constants, logger # config, web_server
from .file_helper import gettempdir from .file_helper import get_temp_dir
log = logger.create() log = logger.create()