From 6d613028fc4603136aa50bb5db8cf1c034fe6ec5 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 11 Apr 2023 22:47:10 -0400 Subject: [PATCH] Fix looking up book using ISBN --- vrobbler/apps/books/models.py | 6 ++---- vrobbler/apps/scrobbles/models.py | 4 +++- vrobbler/apps/scrobbles/scrobblers.py | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/vrobbler/apps/books/models.py b/vrobbler/apps/books/models.py index f8bfd21..28d9175 100644 --- a/vrobbler/apps/books/models.py +++ b/vrobbler/apps/books/models.py @@ -161,12 +161,10 @@ class Book(LongPlayScrobblableMixin): return progress @classmethod - def find_or_create(cls, data_dict: dict) -> "Game": + def find_or_create(cls, lookup_id: str, author: str = "") -> "Game": from books.utils import update_or_create_book - return update_or_create_book( - data_dict.get("title"), data_dict.get("author") - ) + return update_or_create_book(lookup_id, author) class Page(TimeStampedModel): diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index 8679230..c2f190e 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -629,8 +629,10 @@ class Scrobble(TimeStampedModel): # to allow a scrobble to be updated. jellyfin_in_progress = scrobble_data.get("jellyfin_status", None) if scrobble and (scrobble.can_be_updated or jellyfin_in_progress): + source = scrobble_data["source"] + mtype = media.__class__.__name__ logger.info( - f"Updating {scrobble.id}", + f"[scrobbling] updating {scrobble.id} for {mtype} {media.id} from {source}", {"scrobble_data": scrobble_data, "media": media}, ) return scrobble.update(scrobble_data) diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index 415bbc5..1073436 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -210,8 +210,7 @@ def manual_scrobble_video_game(hltb_id: str, user_id: int): def manual_scrobble_book(openlibrary_id: str, user_id: int): - data_dict = lookup_book_from_openlibrary(openlibrary_id) - book = Book.find_or_create(data_dict) + book = Book.find_or_create(openlibrary_id) scrobble_dict = { "user_id": user_id,