Upd based on PR comments

This commit is contained in:
kyxap 2024-06-23 08:54:26 -04:00
parent d0e78e06b6
commit ee309818fe

View File

@ -1859,8 +1859,6 @@ class DeviceMixin: # {{{
def clean_string(x): def clean_string(x):
try: try:
# Replace '&' with 'and' kobo automatically doing this before adding data into db
x = x.replace('&', 'and')
# Convert to lowercase if x is not None or empty # Convert to lowercase if x is not None or empty
x = x.lower() if x else '' x = x.lower() if x else ''
except Exception: except Exception:
@ -1922,7 +1920,7 @@ class DeviceMixin: # {{{
Extracts id from dict with full match by author or partial match for cases when Extracts id from dict with full match by author or partial match for cases when
book has multiple authors. book has multiple authors.
""" """
debug_prints('Trying to extract id for author:', author_to_look_for) debug_prints('Trying to extract id for author:', author_to_look_for, ' in:', target_dict)
if author_to_look_for in target_dict: if author_to_look_for in target_dict:
return target_dict[book_authors] return target_dict[book_authors]
else: else:
@ -2049,8 +2047,7 @@ class DeviceMixin: # {{{
book.application_id = extracted_id book.application_id = extracted_id
if extracted_id is None: if extracted_id is None:
book.in_library = 'NO_AUTHOR_MATCH' debug_prints('No author match for a book: ', book)
debug_prints('No author match for book: ', book)
else: else:
# Book definitely not matched. Clear its application ID # Book definitely not matched. Clear its application ID