diff --git a/cps/helper.py b/cps/helper.py index c33a69e1..add1b067 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -536,9 +536,13 @@ def delete_book(book, calibrepath, book_format): def get_thumbnails_for_books(books): books_with_covers = list(filter(lambda b: b.has_cover, books)) 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\ .query(ub.Thumbnail)\ .filter(ub.Thumbnail.book_id.in_(book_ids))\ + .filter(ub.Thumbnail.filename.in_(thumbnail_files))\ .filter(ub.Thumbnail.expiration > datetime.utcnow())\ .all() diff --git a/cps/tasks/thumbnail.py b/cps/tasks/thumbnail.py index e9df170e..70ddc06b 100644 --- a/cps/tasks/thumbnail.py +++ b/cps/tasks/thumbnail.py @@ -75,7 +75,7 @@ class TaskGenerateCoverThumbnails(CalibreTask): else: 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._handleSuccess()