diff --git a/cps/constants.py b/cps/constants.py index 0736a354..3d1f0dfe 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -193,7 +193,7 @@ THUMBNAIL_TYPE_AUTHOR = 3 COVER_THUMBNAIL_ORIGINAL = 0 COVER_THUMBNAIL_SMALL = 1 COVER_THUMBNAIL_MEDIUM = 2 -COVER_THUMBNAIL_LARGE = 3 +COVER_THUMBNAIL_LARGE = 4 # clean-up the module namespace del sys, os, namedtuple diff --git a/cps/kobo.py b/cps/kobo.py index 03fc29c3..3686c174 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -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 isoLanguages from .epub import get_epub_layout -from .constants import COVER_THUMBNAIL_SMALL +from .constants import COVER_THUMBNAIL_SMALL, COVER_THUMBNAIL_MEDIUM, COVER_THUMBNAIL_LARGE from .helper import get_download_link from .services import SyncToken as SyncToken from .web import download_required @@ -903,7 +903,12 @@ def get_current_bookmark_response(current_bookmark): @requires_kobo_auth def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale): try: - resolution = None if int(height) > 1000 else COVER_THUMBNAIL_SMALL + if int(height) > 1000: + resolution = COVER_THUMBNAIL_LARGE + elif int(height) > 500: + resolution = COVER_THUMBNAIL_MEDIUM + else: + resolution = COVER_THUMBNAIL_SMALL except ValueError: log.error("Requested height %s of book %s is invalid" % (book_uuid, height)) resolution = COVER_THUMBNAIL_SMALL diff --git a/cps/shelf.py b/cps/shelf.py index 6558e8d5..41d5ce1d 100644 --- a/cps/shelf.py +++ b/cps/shelf.py @@ -422,11 +422,14 @@ def render_show_shelf(shelf_type, shelf_id, page_no, sort_param): # check user is allowed to access shelf if shelf and check_shelf_view_permissions(shelf): if shelf_type == 1: - # order = [ub.BookShelf.order.asc()] if sort_param == 'pubnew': change_shelf_order(shelf_id, [db.Books.pubdate.desc()]) if sort_param == 'pubold': change_shelf_order(shelf_id, [db.Books.pubdate]) + if sort_param == 'shelfnew': + change_shelf_order(shelf_id, [ub.BookShelf.date_added.desc()]) + if sort_param == 'shelfold': + change_shelf_order(shelf_id, [ub.BookShelf.date_added]) if sort_param == 'abc': change_shelf_order(shelf_id, [db.Books.sort]) if sort_param == 'zyx': @@ -453,7 +456,7 @@ def render_show_shelf(shelf_type, shelf_id, page_no, sort_param): [ub.BookShelf.order.asc()], True, config.config_read_column, ub.BookShelf, ub.BookShelf.book_id == db.Books.id) - # delete chelf entries where book is not existent anymore, can happen if book is deleted outside calibre-web + # delete shelf entries where book is not existent anymore, can happen if book is deleted outside calibre-web wrong_entries = calibre_db.session.query(ub.BookShelf) \ .join(db.Books, ub.BookShelf.book_id == db.Books.id, isouter=True) \ .filter(db.Books.id == None).all() diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 72f01867..2dbea6bc 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -612,6 +612,8 @@ $(function() { $("#auth_za").toggleClass("disabled"); $("#pub_new").toggleClass("disabled"); $("#pub_old").toggleClass("disabled"); + $("#shelf_new").toggleClass("disabled"); + $("#shelf_old").toggleClass("disabled"); var alternative_text = $("#toggle_order_shelf").data('alt-text'); $("#toggle_order_shelf").data('alt-text', $("#toggle_order_shelf").html()); $("#toggle_order_shelf").html(alternative_text); diff --git a/cps/tasks/thumbnail.py b/cps/tasks/thumbnail.py index 2142b018..cc847274 100644 --- a/cps/tasks/thumbnail.py +++ b/cps/tasks/thumbnail.py @@ -35,7 +35,7 @@ except (ImportError, RuntimeError) as e: def get_resize_height(resolution): - return int(225 * resolution) + return int(255 * resolution) def get_resize_width(resolution, original_width, original_height): @@ -72,7 +72,8 @@ class TaskGenerateCoverThumbnails(CalibreTask): self.cache = fs.FileSystem() self.resolutions = [ constants.COVER_THUMBNAIL_SMALL, - constants.COVER_THUMBNAIL_MEDIUM + constants.COVER_THUMBNAIL_MEDIUM, + constants.COVER_THUMBNAIL_LARGE ] def run(self, worker_thread): diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html index bf0b1ab4..d0fdb399 100644 --- a/cps/templates/shelf.html +++ b/cps/templates/shelf.html @@ -25,6 +25,8 @@ + + {% endif %} {% endif %} diff --git a/cps/ub.py b/cps/ub.py index 5b889a72..0e15b8e2 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -311,7 +311,6 @@ class Anonymous(AnonymousUserMixin, UserBase): self.view_settings = data.view_settings self.kobo_only_shelves_sync = data.kobo_only_shelves_sync - def role_admin(self): return False