diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/video-app.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/video-app.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js index de61839..ce38b0e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js @@ -190,43 +190,43 @@ function MediaThumb({ // ── TMDB metadata, fetched once per visible tile ──────────────────────────── // An operator correcting a wrong match (TmdbSearchOverlay below) changes -// what `media_meta_req` returns for a path every already-mounted tile/modal +// what `media_meta_req` returns for a file every already-mounted tile/modal // already has cached in its own useMediaMeta state — nothing would ever -// refetch otherwise, since path/active don't change. Bumping this and +// refetch otherwise, since fileId/active don't change. Bumping this and // telling every subscribed hook to redo its fetch is simpler than trying to -// know which paths a given override actually affects (that's server-side +// know which files a given override actually affects (that's server-side // knowledge — display_title grouping — this module doesn't have). const _mediaMetaListeners = new Set(); function bumpMediaMetaGeneration() { for (const fn of _mediaMetaListeners) fn(); } -function useMediaMeta(transportRef, path, active) { +function useMediaMeta(transportRef, fileId, active) { const [meta, setMeta] = useState(null); const [refetchToken, setRefetchToken] = useState(0); useEffect(() => { // Clears immediately (so the spinner shows right away, not only once // the new fetch resolves) and bumps the token, which re-runs the fetch - // effect below regardless of whether path/active changed at all. + // effect below regardless of whether fileId/active changed at all. const listener = () => { setMeta(null); setRefetchToken((n) => n + 1); }; _mediaMetaListeners.add(listener); return () => _mediaMetaListeners.delete(listener); }, []); useEffect(() => { - if (!active || !path) return; + if (!active || !fileId) return; let cancelled = false; (async () => { const transport = transportRef.current; if (!transport || !transport.connected) return; try { - const resp = await transport.fetchMediaMeta(path); + const resp = await transport.fetchMediaMeta(fileId); if (!cancelled) setMeta(resp); } catch { if (!cancelled) setMeta({ confidence: 0 }); } })(); return () => { cancelled = true; }; - }, [path, active, refetchToken]); + }, [fileId, active, refetchToken]); return meta; } @@ -266,7 +266,7 @@ function useSeasonMeta(transportRef, tmdbId, season, active) { // ── Mode A: poster grid ────────────────────────────────────────────────────── function PosterCard({ title, subtitle, repEntry, transportRef, gekRef, onOpen, groupKey, onMetaResolved }) { - const meta = useMediaMeta(transportRef, repEntry.path, true); + const meta = useMediaMeta(transportRef, repEntry.id, true); const confident = Boolean(meta && meta.confidence && meta.tmdb_id); const metaReady = meta !== null; @@ -366,7 +366,7 @@ function buildSignFn(transportRef) { } function TmdbSearchOverlay({ - initialQuery, mediaType, path, transportRef, gekRef, onClose, onApplied, + initialQuery, mediaType, fileId, transportRef, gekRef, onClose, onApplied, }) { const [query, setQuery] = useState(initialQuery || ''); const [results, setResults] = useState(null); // null = not searched yet @@ -398,14 +398,14 @@ function TmdbSearchOverlay({ setError(''); try { const signFn = buildSignFn(transportRef); - await transportRef.current.overrideTmdbMatch(path, tmdbId, mediaType, signFn); + await transportRef.current.overrideTmdbMatch(fileId, tmdbId, mediaType, signFn); bumpMediaMetaGeneration(); onApplied(); } catch (err) { setError(err.message); setApplying(false); } - }, [applying, path, mediaType, transportRef, onApplied]); + }, [applying, fileId, mediaType, transportRef, onApplied]); return html` <div class="video-overlay video-search-overlay" onClick=${(e) => { @@ -554,7 +554,7 @@ function VideoDetailModal({ </div> ${searching && html` <${TmdbSearchOverlay} initialQuery=${(confident && meta.title) || title} mediaType=${mediaType} - path=${repEntry.path} transportRef=${transportRef} gekRef=${gekRef} + fileId=${repEntry.id} transportRef=${transportRef} gekRef=${gekRef} onClose=${() => setSearching(false)} onApplied=${() => setSearching(false)} /> `} @@ -615,7 +615,7 @@ function PosterGrid({ movies, shows, transportRef, gekRef, onPreview, tmdbEnable }, [shows, metaByGroup]); const openDetail = (title, repEntry, show) => setDetail({ title, repEntry, show }); - const detailMeta = useMediaMeta(transportRef, detail ? detail.repEntry.path : null, !!detail); + const detailMeta = useMediaMeta(transportRef, detail ? detail.repEntry.id : null, !!detail); return html` <div class="video-grid"> |