mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-29 04:49:58 +00:00
Fix generate thumbnail task messages, don't load thumbnails when the cache file has been deleted
This commit is contained in:
parent
242a2767a1
commit
eef21759cd
@ -536,9 +536,13 @@ def delete_book(book, calibrepath, book_format):
|
|||||||
def get_thumbnails_for_books(books):
|
def get_thumbnails_for_books(books):
|
||||||
books_with_covers = list(filter(lambda b: b.has_cover, books))
|
books_with_covers = list(filter(lambda b: b.has_cover, books))
|
||||||
book_ids = list(map(lambda b: b.id, books_with_covers))
|
book_ids = list(map(lambda b: b.id, books_with_covers))
|
||||||
|
cache = fs.FileSystem()
|
||||||
|
thumbnail_files = cache.list_cache_files(fs.CACHE_TYPE_THUMBNAILS)
|
||||||
|
|
||||||
return ub.session\
|
return ub.session\
|
||||||
.query(ub.Thumbnail)\
|
.query(ub.Thumbnail)\
|
||||||
.filter(ub.Thumbnail.book_id.in_(book_ids))\
|
.filter(ub.Thumbnail.book_id.in_(book_ids))\
|
||||||
|
.filter(ub.Thumbnail.filename.in_(thumbnail_files))\
|
||||||
.filter(ub.Thumbnail.expiration > datetime.utcnow())\
|
.filter(ub.Thumbnail.expiration > datetime.utcnow())\
|
||||||
.all()
|
.all()
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
|||||||
else:
|
else:
|
||||||
self.create_book_thumbnail(book, resolution)
|
self.create_book_thumbnail(book, resolution)
|
||||||
|
|
||||||
self.message(u'Generating cover thumbnail {0} of {1}'.format(i, count))
|
self.message = u'Generating cover thumbnail {0} of {1}'.format(i + 1, count)
|
||||||
self.progress = (1.0 / count) * i
|
self.progress = (1.0 / count) * i
|
||||||
|
|
||||||
self._handleSuccess()
|
self._handleSuccess()
|
||||||
|
Loading…
Reference in New Issue
Block a user