- tmdb.py : recherche TMDB par title+subtitle, matching fuzzy, cache SQLite 30 jours (table tmdb_cache dans arte_dl.db) - arte_api.py : enrichissement concurrent (5 workers) après résolution des IDs ; ajoute tmdb_id, tmdb_poster, tmdb_backdrop au concert - app.js : backdrop TMDB utilisé comme thumbnail de carte quand dispo ; subtitle affiché sous le titre de carte ; poster dans la modal ; lien direct vers la fiche TMDB - docker-compose.yml : passage de TMDB_API_KEY au container Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+12
@@ -6,6 +6,7 @@ import urllib.request
|
||||
import json
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from urllib.parse import quote_plus
|
||||
import tmdb as _tmdb
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -109,6 +110,17 @@ def _fetch_all_sync() -> list[dict]:
|
||||
concerts = _resolve_ids(all_ids)
|
||||
for c in concerts:
|
||||
c["categories"] = id_cats.get(c["id"], [])
|
||||
|
||||
# TMDB enrichment (concurrent, results cached in SQLite)
|
||||
def _enrich(c: dict) -> dict:
|
||||
t = _tmdb.lookup(c["id"], c.get("title", ""), c.get("subtitle", ""))
|
||||
if t:
|
||||
c.update(t)
|
||||
return c
|
||||
|
||||
with ThreadPoolExecutor(max_workers=5) as pool:
|
||||
concerts = list(pool.map(_enrich, concerts))
|
||||
|
||||
concerts.sort(key=lambda c: c.get("expiry") or "", reverse=True)
|
||||
return concerts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user