From 6753c3717f4e4651b2145373131a5aec6a9fd6d5 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 23 May 2023 16:33:22 -0400 Subject: [PATCH] Fix book lookup if OL ID exists --- vrobbler/apps/books/models.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vrobbler/apps/books/models.py b/vrobbler/apps/books/models.py index 9322b93..fa3f9cc 100644 --- a/vrobbler/apps/books/models.py +++ b/vrobbler/apps/books/models.py @@ -103,9 +103,14 @@ class Book(LongPlayScrobblableMixin): author_name = self.author.name if not data: - data = lookup_book_from_openlibrary( - str(self.title), author_name - ) + if self.openlibrary_id: + data = lookup_book_from_openlibrary( + str(self.openlibrary_id) + ) + else: + data = lookup_book_from_openlibrary( + str(self.title), author_name + ) if not data: logger.warn(f"Book not found in OL {self.title}")