diff --git a/arte_api.py b/arte_api.py index acea66f..3a44137 100644 --- a/arte_api.py +++ b/arte_api.py @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 2af43fe..203f7e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,3 +10,4 @@ services: - /mnt/user/appdata/arte-dl:/app/data environment: - TZ=Europe/Paris + - TMDB_API_KEY=${TMDB_API_KEY} diff --git a/static/app.js b/static/app.js index f57ec41..8235e30 100644 --- a/static/app.js +++ b/static/app.js @@ -102,12 +102,14 @@ function renderConcerts(data) { statusText.textContent = `${total} concert${total > 1 ? 's' : ''} · page ${state.page} / ${pages}`; grid.innerHTML = concerts.map(c => { - const thumb = c.thumbnail - ? `` + const imgSrc = c.tmdb_backdrop || c.thumbnail; + const thumb = imgSrc + ? `` : `
`; const dur = c.duration ? `${fmtDuration(c.duration)}` : ''; const dl = state.downloadedUrls.has(c.url) ? `✓ Téléchargé` : ''; const date = fmtDate(c.upload_date); + const sub = c.subtitle ? `
${c.subtitle}
` : ''; return `
@@ -116,6 +118,7 @@ function renderConcerts(data) {
${c.title}
+ ${sub} ${date ? `
${date}
` : ''}
`; @@ -175,9 +178,20 @@ pagination.addEventListener('click', e => { function openModal(concert) { state.current = concert; - $('modal-thumb').src = concert.thumbnail || ''; + const modalThumbEl = $('modal-thumb'); + modalThumbEl.src = concert.tmdb_backdrop || concert.thumbnail || ''; + + const posterEl = $('modal-poster'); + if (concert.tmdb_poster) { + posterEl.src = concert.tmdb_poster; + posterEl.hidden = false; + } else { + posterEl.hidden = true; + } + $('modal-title').textContent = concert.title; $('modal-meta').textContent = [ + concert.subtitle || '', concert.duration ? fmtDuration(concert.duration) : '', concert.upload_date ? fmtDate(concert.upload_date) : '', ].filter(Boolean).join(' · '); @@ -185,6 +199,14 @@ function openModal(concert) { $('modal-dur-badge').textContent = concert.duration ? fmtDuration(concert.duration) : ''; $('btn-watch').href = concert.url || '#'; + const btnTmdb = $('btn-tmdb'); + if (concert.tmdb_id) { + btnTmdb.href = `https://www.themoviedb.org/movie/${concert.tmdb_id}`; + btnTmdb.hidden = false; + } else { + btnTmdb.hidden = true; + } + const btnDl = $('btn-download'); const alreadyDone = state.downloadedUrls.has(concert.url); btnDl.textContent = alreadyDone ? '✓ Déjà téléchargé' : 'Télécharger'; diff --git a/static/style.css b/static/style.css index 9742b07..ea6fb9c 100644 --- a/static/style.css +++ b/static/style.css @@ -337,6 +337,16 @@ body { overflow: hidden; } +.card-subtitle { + margin-top: 3px; + font-size: 11.5px; + color: var(--gold); + letter-spacing: 0.02em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .card-date { margin-top: 6px; font-size: 11.5px; @@ -483,6 +493,26 @@ body { background: linear-gradient(to bottom, transparent 50%, var(--surface) 100%); } +.modal-head { + display: flex; + align-items: flex-start; + gap: 14px; + margin-bottom: 14px; +} + +.modal-head-text { flex: 1; min-width: 0; } + +.modal-poster { + width: 64px; + flex-shrink: 0; + border-radius: 6px; + box-shadow: 0 4px 16px rgba(0,0,0,0.5); + object-fit: cover; + margin-top: 2px; +} + +.modal-poster[hidden] { display: none; } + .modal-duration-badge { position: absolute; bottom: 12px; right: 12px; @@ -505,14 +535,13 @@ body { font-size: 22px; font-weight: 700; line-height: 1.3; - margin-bottom: 8px; + margin-bottom: 6px; } .modal-meta { font-size: 12.5px; color: var(--gold); letter-spacing: 0.04em; - margin-bottom: 14px; } .modal-desc { diff --git a/templates/index.html b/templates/index.html index bbb2a1b..6c12896 100644 --- a/templates/index.html +++ b/templates/index.html @@ -86,8 +86,13 @@