Selaa lähdekoodia

Fix book lookup if OL ID exists

Colin Powell 2 vuotta sitten
vanhempi
commit
6753c3717f
1 muutettua tiedostoa jossa 8 lisäystä ja 3 poistoa
  1. 8 3
      vrobbler/apps/books/models.py

+ 8 - 3
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}")