1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-14 05:44:53 +00:00

Final fix for cover size during kobo sync (fix for #2523)

Update Teststatus
This commit is contained in:
Ozzie Isaacs 2024-08-15 18:35:48 +02:00
parent c7f0293568
commit d2860fc374
2 changed files with 475 additions and 228 deletions

View File

@ -47,7 +47,7 @@ import requests
from . import config, logger, kobo_auth, db, calibre_db, helper, shelf as shelf_lib, ub, csrf, kobo_sync_status from . import config, logger, kobo_auth, db, calibre_db, helper, shelf as shelf_lib, ub, csrf, kobo_sync_status
from . import isoLanguages from . import isoLanguages
from .epub import get_epub_layout from .epub import get_epub_layout
from .constants import COVER_THUMBNAIL_SMALL from .constants import COVER_THUMBNAIL_SMALL, COVER_THUMBNAIL_MEDIUM
from .helper import get_download_link from .helper import get_download_link
from .services import SyncToken as SyncToken from .services import SyncToken as SyncToken
from .web import download_required from .web import download_required
@ -903,7 +903,12 @@ def get_current_bookmark_response(current_bookmark):
@requires_kobo_auth @requires_kobo_auth
def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale): def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale):
try: try:
resolution = None if int(height) > 1000 else COVER_THUMBNAIL_SMALL if int(height) > 1000:
resolution = None
elif int(height) > 500:
resolution = COVER_THUMBNAIL_MEDIUM
else:
resolution = COVER_THUMBNAIL_SMALL
except ValueError: except ValueError:
log.error("Requested height %s of book %s is invalid" % (book_uuid, height)) log.error("Requested height %s of book %s is invalid" % (book_uuid, height))
resolution = COVER_THUMBNAIL_SMALL resolution = COVER_THUMBNAIL_SMALL

File diff suppressed because it is too large Load Diff