mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Correct order of assignment in set_books_in_library.
This commit is contained in:
parent
c77d8c893c
commit
67ebd98cf1
@ -1468,21 +1468,21 @@ class DeviceMixin(object): # {{{
|
|||||||
# will match if any of the db_id, author, or author_sort
|
# will match if any of the db_id, author, or author_sort
|
||||||
# also match.
|
# also match.
|
||||||
if getattr(book, 'application_id', None) in d['db_ids']:
|
if getattr(book, 'application_id', None) in d['db_ids']:
|
||||||
book.in_library = True
|
|
||||||
# app_id already matches a db_id. No need to set it.
|
# app_id already matches a db_id. No need to set it.
|
||||||
if update_metadata:
|
if update_metadata:
|
||||||
book.smart_update(d['db_ids'][book.application_id],
|
book.smart_update(d['db_ids'][book.application_id],
|
||||||
replace_metadata=True)
|
replace_metadata=True)
|
||||||
|
book.in_library = True
|
||||||
continue
|
continue
|
||||||
# Sonys know their db_id independent of the application_id
|
# Sonys know their db_id independent of the application_id
|
||||||
# in the metadata cache. Check that as well.
|
# in the metadata cache. Check that as well.
|
||||||
if getattr(book, 'db_id', None) in d['db_ids']:
|
if getattr(book, 'db_id', None) in d['db_ids']:
|
||||||
book.in_library = True
|
|
||||||
book.application_id = \
|
|
||||||
d['db_ids'][book.db_id].application_id
|
|
||||||
if update_metadata:
|
if update_metadata:
|
||||||
book.smart_update(d['db_ids'][book.db_id],
|
book.smart_update(d['db_ids'][book.db_id],
|
||||||
replace_metadata=True)
|
replace_metadata=True)
|
||||||
|
book.in_library = True
|
||||||
|
book.application_id = \
|
||||||
|
d['db_ids'][book.db_id].application_id
|
||||||
continue
|
continue
|
||||||
# We now know that the application_id is not right. Set it
|
# We now know that the application_id is not right. Set it
|
||||||
# to None to prevent book_on_device from accidentally
|
# to None to prevent book_on_device from accidentally
|
||||||
@ -1494,19 +1494,19 @@ class DeviceMixin(object): # {{{
|
|||||||
# either can appear as the author
|
# either can appear as the author
|
||||||
book_authors = clean_string(authors_to_string(book.authors))
|
book_authors = clean_string(authors_to_string(book.authors))
|
||||||
if book_authors in d['authors']:
|
if book_authors in d['authors']:
|
||||||
book.in_library = True
|
|
||||||
book.application_id = \
|
|
||||||
d['authors'][book_authors].application_id
|
|
||||||
if update_metadata:
|
if update_metadata:
|
||||||
book.smart_update(d['authors'][book_authors],
|
book.smart_update(d['authors'][book_authors],
|
||||||
replace_metadata=True)
|
replace_metadata=True)
|
||||||
elif book_authors in d['author_sort']:
|
|
||||||
book.in_library = True
|
book.in_library = True
|
||||||
book.application_id = \
|
book.application_id = \
|
||||||
d['author_sort'][book_authors].application_id
|
d['authors'][book_authors].application_id
|
||||||
|
elif book_authors in d['author_sort']:
|
||||||
if update_metadata:
|
if update_metadata:
|
||||||
book.smart_update(d['author_sort'][book_authors],
|
book.smart_update(d['author_sort'][book_authors],
|
||||||
replace_metadata=True)
|
replace_metadata=True)
|
||||||
|
book.in_library = True
|
||||||
|
book.application_id = \
|
||||||
|
d['author_sort'][book_authors].application_id
|
||||||
else:
|
else:
|
||||||
# Book definitely not matched. Clear its application ID
|
# Book definitely not matched. Clear its application ID
|
||||||
book.application_id = None
|
book.application_id = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user