From dc2c30f508ca2f1bd4206dea4aef8a84ff4dbd06 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 14 Oct 2023 09:51:54 +0200 Subject: [PATCH] Added additional debug output for download links during kobo sync --- cps/kobo.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 47cc4bda..582cafc3 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -142,6 +142,7 @@ def HandleSyncRequest(): sync_token = SyncToken.SyncToken.from_headers(request.headers) log.info("Kobo library sync request received.") log.debug("SyncToken: {}".format(sync_token)) + log.debug("Download link format {}".format(get_download_url_for_book('[bookid]','[bookformat]'))) if not current_app.wsgi_app.is_proxied: log.debug('Kobo: Received unproxied request, changed request port to external server port') @@ -367,7 +368,7 @@ def HandleMetadataRequest(book_uuid): return response -def get_download_url_for_book(book, book_format): +def get_download_url_for_book(book_id, book_format): if not current_app.wsgi_app.is_proxied: if ':' in request.host and not request.host.endswith(']'): host = "".join(request.host.split(':')[:-1]) @@ -379,13 +380,13 @@ def get_download_url_for_book(book, book_format): url_base=host, url_port=config.config_external_port, auth_token=get_auth_token(), - book_id=book.id, + book_id=book_id, book_format=book_format.lower() ) return url_for( "kobo.download_book", auth_token=kobo_auth.get_auth_token(), - book_id=book.id, + book_id=book_id, book_format=book_format.lower(), _external=True, ) @@ -468,7 +469,7 @@ def get_metadata(book): { "Format": kobo_format, "Size": book_data.uncompressed_size, - "Url": get_download_url_for_book(book, book_data.format), + "Url": get_download_url_for_book(book.id, book_data.format), # The Kobo forma accepts platforms: (Generic, Android) "Platform": "Generic", # "DrmType": "None", # Not required