mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-14 05:44:53 +00:00
Fix for #2990 (Kobo browser not downloading kepub files)
Final fix for cover size during kobo sync (fix for #2523)
This commit is contained in:
commit
c2474aa91d
@ -193,7 +193,7 @@ THUMBNAIL_TYPE_AUTHOR = 3
|
|||||||
COVER_THUMBNAIL_ORIGINAL = 0
|
COVER_THUMBNAIL_ORIGINAL = 0
|
||||||
COVER_THUMBNAIL_SMALL = 1
|
COVER_THUMBNAIL_SMALL = 1
|
||||||
COVER_THUMBNAIL_MEDIUM = 2
|
COVER_THUMBNAIL_MEDIUM = 2
|
||||||
COVER_THUMBNAIL_LARGE = 3
|
COVER_THUMBNAIL_LARGE = 4
|
||||||
|
|
||||||
# clean-up the module namespace
|
# clean-up the module namespace
|
||||||
del sys, os, namedtuple
|
del sys, os, namedtuple
|
||||||
|
@ -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, COVER_THUMBNAIL_LARGE
|
||||||
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 = COVER_THUMBNAIL_LARGE
|
||||||
|
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
|
||||||
|
@ -422,11 +422,14 @@ def render_show_shelf(shelf_type, shelf_id, page_no, sort_param):
|
|||||||
# check user is allowed to access shelf
|
# check user is allowed to access shelf
|
||||||
if shelf and check_shelf_view_permissions(shelf):
|
if shelf and check_shelf_view_permissions(shelf):
|
||||||
if shelf_type == 1:
|
if shelf_type == 1:
|
||||||
# order = [ub.BookShelf.order.asc()]
|
|
||||||
if sort_param == 'pubnew':
|
if sort_param == 'pubnew':
|
||||||
change_shelf_order(shelf_id, [db.Books.pubdate.desc()])
|
change_shelf_order(shelf_id, [db.Books.pubdate.desc()])
|
||||||
if sort_param == 'pubold':
|
if sort_param == 'pubold':
|
||||||
change_shelf_order(shelf_id, [db.Books.pubdate])
|
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':
|
if sort_param == 'abc':
|
||||||
change_shelf_order(shelf_id, [db.Books.sort])
|
change_shelf_order(shelf_id, [db.Books.sort])
|
||||||
if sort_param == 'zyx':
|
if sort_param == 'zyx':
|
||||||
@ -453,7 +456,7 @@ def render_show_shelf(shelf_type, shelf_id, page_no, sort_param):
|
|||||||
[ub.BookShelf.order.asc()],
|
[ub.BookShelf.order.asc()],
|
||||||
True, config.config_read_column,
|
True, config.config_read_column,
|
||||||
ub.BookShelf, ub.BookShelf.book_id == db.Books.id)
|
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) \
|
wrong_entries = calibre_db.session.query(ub.BookShelf) \
|
||||||
.join(db.Books, ub.BookShelf.book_id == db.Books.id, isouter=True) \
|
.join(db.Books, ub.BookShelf.book_id == db.Books.id, isouter=True) \
|
||||||
.filter(db.Books.id == None).all()
|
.filter(db.Books.id == None).all()
|
||||||
|
@ -612,6 +612,8 @@ $(function() {
|
|||||||
$("#auth_za").toggleClass("disabled");
|
$("#auth_za").toggleClass("disabled");
|
||||||
$("#pub_new").toggleClass("disabled");
|
$("#pub_new").toggleClass("disabled");
|
||||||
$("#pub_old").toggleClass("disabled");
|
$("#pub_old").toggleClass("disabled");
|
||||||
|
$("#shelf_new").toggleClass("disabled");
|
||||||
|
$("#shelf_old").toggleClass("disabled");
|
||||||
var alternative_text = $("#toggle_order_shelf").data('alt-text');
|
var alternative_text = $("#toggle_order_shelf").data('alt-text');
|
||||||
$("#toggle_order_shelf").data('alt-text', $("#toggle_order_shelf").html());
|
$("#toggle_order_shelf").data('alt-text', $("#toggle_order_shelf").html());
|
||||||
$("#toggle_order_shelf").html(alternative_text);
|
$("#toggle_order_shelf").html(alternative_text);
|
||||||
|
@ -35,7 +35,7 @@ except (ImportError, RuntimeError) as e:
|
|||||||
|
|
||||||
|
|
||||||
def get_resize_height(resolution):
|
def get_resize_height(resolution):
|
||||||
return int(225 * resolution)
|
return int(255 * resolution)
|
||||||
|
|
||||||
|
|
||||||
def get_resize_width(resolution, original_width, original_height):
|
def get_resize_width(resolution, original_width, original_height):
|
||||||
@ -72,7 +72,8 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
|||||||
self.cache = fs.FileSystem()
|
self.cache = fs.FileSystem()
|
||||||
self.resolutions = [
|
self.resolutions = [
|
||||||
constants.COVER_THUMBNAIL_SMALL,
|
constants.COVER_THUMBNAIL_SMALL,
|
||||||
constants.COVER_THUMBNAIL_MEDIUM
|
constants.COVER_THUMBNAIL_MEDIUM,
|
||||||
|
constants.COVER_THUMBNAIL_LARGE
|
||||||
]
|
]
|
||||||
|
|
||||||
def run(self, worker_thread):
|
def run(self, worker_thread):
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
<a data-toggle="tooltip" title="{{_('Sort authors in reverse alphabetical order')}}" id="auth_za" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='authza')}}"><span class="glyphicon glyphicon-user"></span><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></a>
|
<a data-toggle="tooltip" title="{{_('Sort authors in reverse alphabetical order')}}" id="auth_za" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='authza')}}"><span class="glyphicon glyphicon-user"></span><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></a>
|
||||||
<a data-toggle="tooltip" title="{{_('Sort according to publishing date, newest first')}}" id="pub_new" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubnew')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order"></span></a>
|
<a data-toggle="tooltip" title="{{_('Sort according to publishing date, newest first')}}" id="pub_new" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubnew')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order"></span></a>
|
||||||
<a data-toggle="tooltip" title="{{_('Sort according to publishing date, oldest first')}}" id="pub_old" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubold')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order-alt"></span></a>
|
<a data-toggle="tooltip" title="{{_('Sort according to publishing date, oldest first')}}" id="pub_old" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='pubold')}}"><span class="glyphicon glyphicon-calendar"></span><span class="glyphicon glyphicon-sort-by-order-alt"></span></a>
|
||||||
|
<a data-toggle="tooltip" title="{{_('Sort according to book added to shelf, newest first')}}" id="shelf_new" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='shelfnew')}}"><span class="glyphicon glyphicon-list"></span><span class="glyphicon glyphicon-sort-by-order"></span></a>
|
||||||
|
<a data-toggle="tooltip" title="{{_('Sort according to book added to shelf, oldest first')}}" id="shelf_old" class="btn btn-primary disabled" href="{{url_for('shelf.show_shelf', shelf_id=shelf.id, sort_param='shelfold')}}"><span class="glyphicon glyphicon-list"></span><span class="glyphicon glyphicon-sort-by-order-alt"></span></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -311,7 +311,6 @@ class Anonymous(AnonymousUserMixin, UserBase):
|
|||||||
self.view_settings = data.view_settings
|
self.view_settings = data.view_settings
|
||||||
self.kobo_only_shelves_sync = data.kobo_only_shelves_sync
|
self.kobo_only_shelves_sync = data.kobo_only_shelves_sync
|
||||||
|
|
||||||
|
|
||||||
def role_admin(self):
|
def role_admin(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user