This commit is contained in:
nose
2025-12-17 03:16:41 -08:00
parent 86918f2ae2
commit 5104689a53
10 changed files with 146 additions and 620 deletions

View File

@@ -19,7 +19,7 @@ from API.HTTP import HTTPClient
from ProviderCore.base import SearchProvider, SearchResult
from ProviderCore.download import download_file, sanitize_filename
from cli_syntax import get_field, get_free_text, parse_query
from SYS.logger import log
from SYS.logger import debug, log
from SYS.utils import unique_path
try:
@@ -564,7 +564,7 @@ class OpenLibrary(SearchProvider):
if val:
new_tags.append(f"{ns}:{val}")
log(f"Found {len(new_tags)} tag(s) from ISBN lookup")
debug(f"Found {len(new_tags)} tag(s) from ISBN lookup")
return new_tags
@staticmethod
@@ -703,7 +703,7 @@ class OpenLibrary(SearchProvider):
if isinstance(ocaid, str) and ocaid.strip():
new_tags.append(f"internet_archive:{ocaid.strip()}")
log(f"Found {len(new_tags)} tag(s) from OpenLibrary lookup")
debug(f"Found {len(new_tags)} tag(s) from OpenLibrary lookup")
return new_tags
def search(
@@ -788,7 +788,6 @@ class OpenLibrary(SearchProvider):
availability_rows: List[Tuple[str, str, str, str]] = [("unknown", "", "", "") for _ in range(len(docs))]
if docs:
log(f"[openlibrary] Enriching availability for {len(docs)} result(s)...")
max_workers = min(8, max(1, len(docs)))
done = 0
with futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
@@ -804,9 +803,7 @@ class OpenLibrary(SearchProvider):
except Exception:
availability_rows[i] = ("unknown", "", "", "")
done += 1
if done in {1, len(future_to_index)} or (done % 10 == 0):
log(f"[openlibrary] Availability: {done}/{len(future_to_index)}")
log("[openlibrary] Availability enrichment complete")
for idx, doc in enumerate(docs):
if not isinstance(doc, dict):