فهرست منبع

[books] Clean up google searches

Colin Powell 4 هفته پیش
والد
کامیت
80fcb6c002
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      vrobbler/apps/books/sources/google.py

+ 6 - 4
vrobbler/apps/books/sources/google.py

@@ -59,13 +59,15 @@ def lookup_book_from_google(title: str) -> dict:
     book_dict["genres"] = google_result.get("categories")
     book_dict["cover_url"] = (
         google_result.get("imageLinks", {})
-        .get("thumbnail")
+        .get("thumbnail", "")
         .replace("zoom=1", "zoom=15")
         .replace("&edge=curl", "")
     )
 
-    book_dict["run_time_seconds"] = book_dict.get("pages", 10) * getattr(
-        settings, "AVERAGE_PAGE_READING_SECONDS", 60
-    )
+    book_dict["run_time_seconds"] = 3600
+    if book_dict.get("pages"):
+        book_dict["run_time_seconds"] = book_dict.get("pages", 10) * getattr(
+            settings, "AVERAGE_PAGE_READING_SECONDS", 60
+        )
 
     return book_dict