[books] Clean up google searches

This commit is contained in:
2025-10-20 14:54:53 -04:00
parent c6f3c90006
commit 80fcb6c002

View File

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