mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Possible? fix for device books not matching issue
This commit is contained in:
parent
eaf9e2adc0
commit
fa3f74f2dd
@ -1705,22 +1705,31 @@ class DeviceMixin(object): # {{{
|
|||||||
return
|
return
|
||||||
mi = db.get_metadata(id_, index_is_id=True, get_cover=get_covers)
|
mi = db.get_metadata(id_, index_is_id=True, get_cover=get_covers)
|
||||||
book.smart_update(mi, replace_metadata=True)
|
book.smart_update(mi, replace_metadata=True)
|
||||||
if get_covers:
|
if get_covers and desired_thumbnail_height != 0:
|
||||||
if book.cover and os.access(book.cover, os.R_OK):
|
if book.cover and os.access(book.cover, os.R_OK):
|
||||||
book.thumbnail = self.cover_to_thumbnail(open(book.cover, 'rb').read())
|
book.thumbnail = self.cover_to_thumbnail(open(book.cover, 'rb').read())
|
||||||
else:
|
else:
|
||||||
book.thumbnail = self.default_thumbnail
|
book.thumbnail = self.default_thumbnail
|
||||||
|
|
||||||
|
def updateq(id_, book):
|
||||||
|
try:
|
||||||
|
return (update_metadata and
|
||||||
|
(db.metadata_last_modified(id_, index_is_id=True) !=
|
||||||
|
getattr(book, 'last_modified', None) or
|
||||||
|
(isinstance(getattr(book, 'thumbnail', None), (list, tuple))
|
||||||
|
and max(book.thumbnail[0], book.thumbnail[1]) != desired_thumbnail_height
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
return True
|
||||||
|
|
||||||
for booklist in booklists:
|
for booklist in booklists:
|
||||||
for book in booklist:
|
for book in booklist:
|
||||||
book.in_library = None
|
book.in_library = None
|
||||||
if getattr(book, 'uuid', None) in self.db_book_uuid_cache:
|
if getattr(book, 'uuid', None) in self.db_book_uuid_cache:
|
||||||
id_ = db_book_uuid_cache[book.uuid]
|
id_ = db_book_uuid_cache[book.uuid]
|
||||||
if (db.metadata_last_modified(id_, index_is_id=True) !=
|
if updateq(id_, book):
|
||||||
getattr(book, 'last_modified', None)
|
|
||||||
or (not book.thumbnail
|
|
||||||
or max(book.thumbnail[0], book.thumbnail[1]) !=
|
|
||||||
desired_thumbnail_height)):
|
|
||||||
update_book(id_, book)
|
update_book(id_, book)
|
||||||
book.in_library = 'UUID'
|
book.in_library = 'UUID'
|
||||||
# ensure that the correct application_id is set
|
# ensure that the correct application_id is set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user