aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
diff options
context:
space:
mode:
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.js25
1 files changed, 16 insertions, 9 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 4f52b16..57da9ff 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
@@ -57,10 +57,11 @@ function yearOf(dateStr) {
// work for this group before that either (daemon.py's
// _enrich_new_video_entries), so falling back to "the whole index" here
// would just show files nothing has enriched.
-function underVideoRoot(entry, videoRoot) {
- if (!videoRoot) return false;
+function underVideoRoot(entry, directories) {
+ const dirs = directories || [];
+ if (!dirs.length) return false;
const p = entry.path || '';
- return p === videoRoot || p.startsWith(videoRoot + '/');
+ return dirs.some((d) => p === d || p.startsWith(d + '/'));
}
function buildSeasons(episodes) {
@@ -96,12 +97,12 @@ function defaultSeason(show) {
return Math.min(...(real.length ? real : numbers));
}
-function groupVideoEntries(entries, videoRoot) {
+function groupVideoEntries(entries, videoDirectories) {
const movies = [];
const showsByTitle = new Map();
for (const e of entries) {
if (e.type !== 'video') continue;
- if (!underVideoRoot(e, videoRoot)) continue;
+ if (!underVideoRoot(e, videoDirectories)) continue;
if (e.season != null && e.episode != null) {
const title = e.display_title || e.name;
if (!showsByTitle.has(title)) showsByTitle.set(title, { title, episodes: [] });
@@ -1040,7 +1041,8 @@ function FlatList({ movies, shows, transportRef, gekRef, onPreview, onNeedConn }
// ── shell ────────────────────────────────────────────────────────────────────
function VideoApp({
- groupId, transportRef, gekRef, status, entries, onPreview, videoRoot, tmdbConfig, isNodeAdmin,
+ groupId, transportRef, gekRef, status, entries, availableEntries, onPreview,
+ videoDirectories, tmdbConfig, isNodeAdmin,
hideFilter, onNeedConn,
}) {
const [mode, setMode] = useState(loadViewMode);
@@ -1056,8 +1058,13 @@ function VideoApp({
const setModeAndSave = (m) => { setMode(m); saveViewMode(m); };
+ const videoEntries = availableEntries || entries;
+ // One or several folders now, so the "is anything configured" question
+ // is asked once rather than by every branch testing a string.
+ const configured = (videoDirectories || []).length > 0;
const { movies, shows } = useMemo(
- () => groupVideoEntries(entries, videoRoot), [entries, videoRoot]);
+ () => groupVideoEntries(videoEntries, videoDirectories),
+ [videoEntries, videoDirectories]);
const needle = filter.trim().toLowerCase();
const filteredMovies = useMemo(() => (typeFilter === 'series' ? [] : !needle ? movies : movies.filter(
@@ -1072,10 +1079,10 @@ function VideoApp({
${status === 'offline' && html`
<p class="page-message">${t('group.offline_title')} ${t('group.offline_hint')}</p>
`}
- ${status === 'connected' && !videoRoot && html`
+ ${status === 'connected' && !configured && html`
<p class="page-message">${t('video.no_root_configured')}</p>
`}
- ${status === 'connected' && videoRoot && html`
+ ${status === 'connected' && configured && html`
<div class="video-toolbar">
<button class="tb-btn ${mode === 'poster' ? 'active' : ''}"
onClick=${() => setModeAndSave('poster')}>