This commit is contained in:
2026-01-03 21:23:55 -08:00
parent 73f3005393
commit 3acf21a673
10 changed files with 1244 additions and 43 deletions

View File

@@ -780,9 +780,9 @@ class OpenLibrary(Provider):
elif isinstance(collection, str):
values = [collection.strip().lower()]
if any(v in {"inlibrary",
"printdisabled",
"lendinglibrary"} for v in values):
# Treat borrowable as "inlibrary" (and keep "lendinglibrary" as a safe alias).
# IMPORTANT: do NOT treat "printdisabled" alone as borrowable.
if any(v in {"inlibrary", "lendinglibrary"} for v in values):
return True, "archive-collection"
return False, "archive-not-lendable"
except Exception:
@@ -1312,11 +1312,11 @@ class OpenLibrary(Provider):
if lendable_local:
return "borrow", reason_local, archive_id_local, ""
# Not lendable: check whether it's directly downloadable (public domain uploads, etc.).
# OpenLibrary API can be a false-negative; fall back to Archive metadata.
try:
can_direct, pdf_url = self._archive_check_direct_download(archive_id_local)
if can_direct and pdf_url:
return "download", reason_local, archive_id_local, str(pdf_url)
lendable2, reason2 = self._archive_is_lendable(archive_id_local)
if lendable2:
return "borrow", reason2 or reason_local, archive_id_local, ""
except Exception:
pass
@@ -1401,6 +1401,11 @@ class OpenLibrary(Provider):
if 0 <= idx < len(availability_rows):
availability, availability_reason, archive_id, direct_url = availability_rows[idx]
# UX requirement: OpenLibrary provider should ONLY show borrowable books.
# Ignore printdisabled-only and non-borrow items.
if availability != "borrow":
continue
# Patch the display column.
for idx, (name, _val) in enumerate(columns):
if name == "Avail":