@@ -9787,8 +9740,6 @@
-
-
diff --git a/webui/static/video/video-channel.js b/webui/static/video/video-channel.js
deleted file mode 100644
index 7c40c1de..00000000
--- a/webui/static/video/video-channel.js
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * SoulSync — Video YouTube Channel detail page (isolated).
- *
- * Opens in-app like a show/movie via soulsync:video-open-detail {kind:'channel',
- * source:'youtube', id:
}. Banner hero (avatar, stats, tags, Follow),
- * a sortable/filterable upload grid with Load-more + per-video inline detail, and
- * the channel's playlists as collapsible "seasons". Sibling of video-person.js;
- * listens only for kind==='channel'. Styled by .vc-* in video-side.css.
- */
-(function () {
- 'use strict';
-
- var PAGE_ID = 'video-channel-detail';
- var YT = function () { return window.VideoYoutube; };
- var PAGE_SIZE = 60;
- var state = { id: null, channel: null, videos: {}, all: [], sort: 'newest',
- wishedOnly: false, limit: PAGE_SIZE, plLoaded: {} };
-
- function $(s, r) { return (r || document).querySelector(s); }
- function esc(s) { return YT() ? YT().esc(s) : String(s == null ? '' : s); }
- function show(el, on) { if (el) el.hidden = !on; }
- function watchUrl(v) { return 'https://www.youtube.com/watch?v=' + encodeURIComponent(v); }
- function channelUrl(id) { return 'https://www.youtube.com/channel/' + encodeURIComponent(id); }
-
- // ── a video tile (used in the main grid AND inside playlist sections) ──────
- function videoCard(v) {
- var dur = YT().fmtDuration(v.duration_seconds);
- var thumb = v.thumbnail_url
- ? ' '
- : '';
- var bits = [];
- var d = YT().fmtDate(v.published_at); if (d) bits.push(esc(d));
- var vc = YT().compactCount(v.view_count); if (vc) bits.push(esc(vc) + ' views');
- return '';
- }
-
- function applyGrid() {
- var list = state.all.slice();
- if (state.wishedOnly) list = list.filter(function (v) { return v.wished; });
- if (state.sort === 'oldest') list.reverse(); // state.all is newest-first
- else if (state.sort === 'views') list.sort(function (a, b) { return (b.view_count || 0) - (a.view_count || 0); });
- var grid = $('[data-vc-videos]'); if (grid) grid.innerHTML = list.map(videoCard).join('');
- var count = $('[data-vc-count]');
- if (count) count.textContent = list.length + (state.wishedOnly ? ' wished' : ' shown');
- show($('[data-vc-empty]'), !list.length);
- }
-
- function render(d) {
- var ch = d.channel || {};
- state.channel = ch; state.videos = {}; state.all = (ch.videos || []).slice();
- state.all.forEach(function (v) { state.videos[v.youtube_id] = v; });
-
- var banner = $('[data-vc-banner]');
- if (banner) banner.style.backgroundImage = ch.banner_url ? "url('" + YT().img(ch.banner_url) + "')" : '';
- var page = $('[data-video-channel]'); if (page) page.setAttribute('data-has-banner', ch.banner_url ? '1' : '0');
-
- var av = $('[data-vc-avatar]'), avph = $('[data-vc-avatar-ph]');
- if (av) {
- if (ch.avatar_url) { av.src = YT().img(ch.avatar_url); show(av, true); if (avph) avph.hidden = true; }
- else { show(av, false); if (avph) avph.hidden = false; }
- }
- var name = $('[data-vc-name]'); if (name) name.textContent = ch.title || 'Channel';
- var meta = $('[data-vc-meta]');
- if (meta) {
- var m = [];
- if (ch.handle) m.push(esc(ch.handle));
- var subs = YT().compactCount(ch.subscriber_count); if (subs) m.push(subs + ' subscribers');
- if (ch.video_count != null) m.push(esc(ch.video_count) + ' videos');
- var views = YT().compactCount(ch.view_count); if (views) m.push(views + ' views');
- meta.innerHTML = m.join('· ');
- }
- var tags = $('[data-vc-tags]');
- if (tags) {
- tags.innerHTML = (ch.tags || []).map(function (t) { return '' + esc(t) + ' '; }).join('');
- tags.hidden = !(ch.tags && ch.tags.length);
- }
- var desc = $('[data-vc-desc]');
- if (desc) { desc.textContent = ch.description || ''; desc.hidden = !ch.description; }
- var yt = $('[data-vc-yt]'); if (yt) yt.href = channelUrl(ch.youtube_id);
- setFollow(!!d.following);
-
- applyGrid();
- // More uploads likely exist if we got a full page back.
- show($('[data-vc-more]'), state.all.length >= state.limit);
- loadPlaylists(ch.youtube_id);
- }
-
- function setFollow(on) {
- var b = $('[data-vc-follow]'); if (!b) return;
- b.classList.toggle('vc-follow--on', on);
- b.textContent = on ? '✓ Following' : '+ Follow';
- }
-
- // ── playlists ("seasons") ──────────────────────────────────────────────────
- function playlistRow(p) {
- var thumb = p.thumbnail_url
- ? ' '
- : '▶ ';
- var n = p.video_count != null ? p.video_count + ' video' + (p.video_count === 1 ? '' : 's') : '';
- return '' +
- '
' + thumb +
- '
' + esc(p.title) + ' ' +
- (n ? '' + n + ' ' : '') + '
' +
- '
▾ ' +
- '
' +
- '
' +
- '
';
- }
-
- function loadPlaylists(cid) {
- var sec = $('[data-vc-pl-section]'), host = $('[data-vc-playlists]');
- if (host) host.innerHTML = '';
- if (sec) sec.hidden = true;
- if (!cid) return;
- fetch('/api/video/youtube/playlists/' + encodeURIComponent(cid), { headers: { Accept: 'application/json' } })
- .then(function (r) { return r.ok ? r.json() : null; })
- .then(function (d) {
- var pls = (d && d.playlists) || [];
- if (!pls.length || !host) return;
- host.innerHTML = pls.map(playlistRow).join('');
- if (sec) sec.hidden = false;
- })
- .catch(function () { /* best-effort */ });
- }
-
- function loadPlaylistVideos(pid) {
- if (state.plLoaded[pid]) return;
- state.plLoaded[pid] = true;
- var host = $('[data-vc-pl-vids="' + pid + '"]'); if (!host) return;
- host.innerHTML = 'Loading…
';
- fetch('/api/video/youtube/playlist/' + encodeURIComponent(pid), { headers: { Accept: 'application/json' } })
- .then(function (r) { return r.ok ? r.json() : null; })
- .then(function (d) {
- var vids = (d && d.videos) || [];
- vids.forEach(function (v) { state.videos[v.youtube_id] = v; });
- host.innerHTML = vids.length ? vids.map(videoCard).join('') : 'No videos.
';
- })
- .catch(function () { state.plLoaded[pid] = false; host.innerHTML = ''; });
- }
-
- // ── load ───────────────────────────────────────────────────────────────────
- function load(id, keepLimit) {
- state.id = id;
- if (!keepLimit) { state.limit = PAGE_SIZE; state.plLoaded = {}; }
- var ld = $('[data-vc-loading]'); show(ld, true);
- if (!keepLimit) { var g = $('[data-vc-videos]'); if (g) g.innerHTML = ''; }
- fetch('/api/video/youtube/channel/' + encodeURIComponent(id) + '?limit=' + state.limit,
- { headers: { Accept: 'application/json' } })
- .then(function (r) { return r.ok ? r.json() : null; })
- .then(function (d) {
- show(ld, false);
- if (!d || !d.success) {
- var nm = $('[data-vc-name]'); if (nm) nm.textContent = 'Channel unavailable';
- show($('[data-vc-empty]'), true);
- return;
- }
- render(d);
- })
- .catch(function () { show(ld, false); });
- }
-
- // ── interactions ──────────────────────────────────────────────────────────
- function channelStub() {
- var c = state.channel || {};
- return { youtube_id: c.youtube_id, title: c.title, avatar_url: c.avatar_url };
- }
-
- function toggleWish(btn) {
- if (!YT()) return;
- var id = btn.getAttribute('data-vc-wish');
- var v = state.videos[id]; if (!v) return;
- var on = btn.classList.contains('vc-wish--on');
- btn.disabled = true;
- var setOn = function (val) {
- v.wished = val; btn.disabled = false;
- // reflect on every card with this id (grid + playlists)
- var btns = document.querySelectorAll('[data-vc-wish="' + id + '"]');
- for (var i = 0; i < btns.length; i++) {
- btns[i].classList.toggle('vc-wish--on', val);
- btns[i].textContent = val ? '✓ Wished' : '+ Wish';
- }
- document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed'));
- };
- if (on) YT().removeWish('video', id).then(function (d) { setOn(!(d && d.success)); }).catch(function () { btn.disabled = false; });
- else YT().addVideos(channelStub(), [v]).then(function (d) {
- setOn(!!(d && d.success));
- if (d && d.success && typeof showToast === 'function') showToast('Added to wishlist', 'success');
- }).catch(function () { btn.disabled = false; });
- }
-
- function toggleFollow(btn) {
- if (!YT()) return;
- var on = btn.classList.contains('vc-follow--on');
- btn.disabled = true;
- var done = function () { btn.disabled = false; document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed')); load(state.id, true); };
- if (on) YT().unfollow(state.id).then(done).catch(function () { btn.disabled = false; });
- else YT().follow(channelStub()).then(function (d) {
- if (d && d.success && typeof showToast === 'function') showToast('Following · ' + (d.added_videos || 0) + ' videos added', 'success');
- done();
- }).catch(function () { btn.disabled = false; });
- }
-
- // expand a video's full description/stats inline (lazy, cached on the object)
- function toggleExpand(body) {
- var id = body.getAttribute('data-vc-expand');
- var panel = $('[data-vc-detail="' + id + '"]', body.parentNode); if (!panel) return;
- if (!panel.hidden) { panel.hidden = true; return; }
- panel.hidden = false;
- var v = state.videos[id] || {};
- if (v._full) { panel.innerHTML = detailHTML(v._full); return; }
- if (v._loading) return;
- v._loading = true;
- panel.innerHTML = 'Loading details…
';
- fetch('/api/video/youtube/video/' + encodeURIComponent(id), { headers: { Accept: 'application/json' } })
- .then(function (r) { return r.ok ? r.json() : null; })
- .then(function (d) {
- v._loading = false; v._full = (d && d.video) || {};
- if (!panel.hidden) panel.innerHTML = detailHTML(v._full);
- })
- .catch(function () { v._loading = false; panel.innerHTML = 'No details.
'; });
- }
- function detailHTML(f) {
- var stats = [];
- var likes = YT().compactCount(f.like_count); if (likes) stats.push(likes + ' likes');
- var vc = YT().compactCount(f.view_count); if (vc) stats.push(vc + ' views');
- return (stats.length ? '' + esc(stats.join(' · ')) + '
' : '') +
- (f.description ? '' + esc(f.description) + '
' : 'No description.
');
- }
-
- function onClick(e) {
- var t = e.target;
- var wish = t.closest('[data-vc-wish]'); if (wish) { e.preventDefault(); toggleWish(wish); return; }
- var fb = t.closest('[data-vc-follow]'); if (fb) { e.preventDefault(); toggleFollow(fb); return; }
- if (t.closest('[data-vc-ext]')) return; // thumbnail / YouTube link
- var more = t.closest('[data-vc-more]'); if (more) { e.preventDefault(); state.limit += PAGE_SIZE; load(state.id, true); return; }
- var plt = t.closest('[data-vc-pl-toggle]');
- if (plt) {
- var pid = plt.getAttribute('data-vc-pl-toggle');
- var blk = plt.closest('.vc-pl');
- if (blk && blk.classList.toggle('vc-pl--collapsed') === false) loadPlaylistVideos(pid);
- return;
- }
- var exp = t.closest('[data-vc-expand]'); if (exp) { e.preventDefault(); toggleExpand(exp); return; }
- }
-
- function onOpen(e) {
- if (!e || !e.detail || e.detail.kind !== 'channel') return;
- load(e.detail.id);
- }
-
- function init() {
- var page = $('[data-video-channel]');
- if (page) page.addEventListener('click', onClick);
- var sort = $('[data-vc-sort]');
- if (sort) sort.addEventListener('change', function () { state.sort = sort.value; applyGrid(); });
- var wt = $('[data-vc-wished-toggle]');
- if (wt) wt.addEventListener('click', function () {
- state.wishedOnly = !state.wishedOnly;
- wt.classList.toggle('vc-tool-btn--on', state.wishedOnly);
- applyGrid();
- });
- document.addEventListener('soulsync:video-open-detail', onOpen);
- }
-
- if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
- else init();
-})();
diff --git a/webui/static/video/video-detail.js b/webui/static/video/video-detail.js
index 471e8098..b754edb4 100644
--- a/webui/static/video/video-detail.js
+++ b/webui/static/video/video-detail.js
@@ -71,21 +71,23 @@
return null;
}
function seasonArt(s) {
- if (data && data.source === 'tmdb') return s.poster_url || data.poster_url || '';
+ // tmdb + youtube carry direct (already-proxied for yt) art urls on the payload.
+ if (data && (data.source === 'tmdb' || data.source === 'youtube')) return s.poster_url || data.poster_url || '';
return (s.has_poster && s.id != null) ? '/api/video/poster/season/' + s.id
: (data && data.has_poster ? '/api/video/poster/show/' + data.id : '');
}
// Source-aware billboard art: library items proxy through /api/video; tmdb
- // (preview) items use the direct image URLs in the payload.
+ // (preview) + youtube items use the (proxied) image URLs in the payload.
function bbBackdrop(d) {
- if (d.source === 'tmdb') return d.backdrop_url || d.poster_url || '';
+ if (d.source === 'tmdb' || d.source === 'youtube') return d.backdrop_url || d.poster_url || '';
var art = '/' + d.kind + '/' + d.id;
return d.has_backdrop ? '/api/video/backdrop' + art : (d.has_poster ? '/api/video/poster' + art : '');
}
function bbPoster(d) {
// The offscreen poster is canvas-sampled for the accent — must be
- // same-origin, so tmdb (preview) posters go through our image proxy.
+ // same-origin, so tmdb posters proxy; youtube urls are already proxied.
if (d.source === 'tmdb') return d.poster_url ? proxied(d.poster_url) : '';
+ if (d.source === 'youtube') return d.poster_url || '';
return d.has_poster ? '/api/video/poster/' + d.kind + '/' + d.id : '';
}
function proxied(url) {
@@ -161,6 +163,21 @@
if (tl) { tl.textContent = d.tagline || ''; tl.hidden = !d.tagline; }
var meta = [];
+ if (d.source === 'youtube') {
+ meta.push('YouTube ');
+ var yc = window.VideoYoutube;
+ var subs = yc && yc.compactCount(d.subscriber_count); if (subs) meta.push('' + subs + ' subscribers ');
+ if (d.video_count != null) meta.push('' + esc(d.video_count) + ' videos ');
+ var views = yc && yc.compactCount(d.view_count); if (views) meta.push('' + views + ' views ');
+ if (d.handle) meta.push('' + esc(d.handle) + ' ');
+ var mm = q('[data-vd-meta]'); if (mm) mm.innerHTML = meta.join('');
+ renderActions(d);
+ var ll = q('[data-vd-links]'); if (ll) ll.innerHTML = '';
+ var gg = q('[data-vd-genres]');
+ if (gg) gg.innerHTML = (d.genres || []).slice(0, 8).map(function (gn) { return '' + esc(gn) + ' '; }).join('');
+ renderRatings(d); renderCrewLine(d); renderNextEpisode(d); renderCast(d);
+ return;
+ }
if (d.source === 'tmdb') {
meta.push('Preview ');
} else if (d.kind === 'show') {
@@ -317,6 +334,15 @@
function renderActions(d) {
var a = q('[data-vd-actions]');
if (!a) return;
+ if (d.source === 'youtube') {
+ var on = !!d.following;
+ a.innerHTML =
+ '' +
+ (on ? '✓ Following' : '+ Follow') + ' ' +
+ 'Open on YouTube ↗ ';
+ return;
+ }
// The watchlist eye applies only to airing shows (movies + ended shows are
// terminal — they get acquisition, not a "watch for new" follow).
var isAiringShow = d.kind === 'show' && d.tmdb_id && (!window.VideoGet || VideoGet.isAiring(d.status));
@@ -905,7 +931,30 @@
}
// ── episodes ──────────────────────────────────────────────────────────────
+ // A YouTube video as an "episode": still + title + date, a Wish toggle instead
+ // of owned/missing, expand → full description (lazy).
+ function ytEpisodeRow(ep) {
+ var key = selectedSeason + '_' + ep.episode_number;
+ var still = ep.still_url
+ ? ' '
+ : '';
+ var meta = [];
+ if (ep.air_date) meta.push(fmtDate(ep.air_date));
+ var wished = !!ep.owned;
+ return '' +
+ '
' + still + '▶
' +
+ '
' +
+ esc(ep.title || 'Untitled') + ' ' +
+ (meta.length ? '' + esc(meta.join(' · ')) + ' ' : '') + '
' +
+ (ep.overview ? '
' + esc(ep.overview) + '
' : '') + '
' +
+ '
' + (wished ? '✓ Wished' : '+ Wish') + ' ' +
+ '
⌄ ' +
+ '';
+ }
+
function episodeRow(ep) {
+ if (data && data.source === 'youtube') return ytEpisodeRow(ep);
var owned = ep.owned ? 'vd-ep--owned' : 'vd-ep--missing';
var meta = [];
var rt = runtimeLabel(ep.runtime_minutes); if (rt) meta.push(rt);
@@ -943,6 +992,26 @@
}
}
function loadEpisodeExtra(key, panel) {
+ // YouTube: the row carries the video id → fetch its full metadata.
+ if (data && data.source === 'youtube') {
+ var row = q('[data-vd-ep-key="' + key + '"]');
+ var vid = row && row.getAttribute('data-vd-yt-vid');
+ if (!vid) { panel.innerHTML = ''; return; }
+ panel.innerHTML = '';
+ fetch('/api/video/youtube/video/' + encodeURIComponent(vid), { headers: { 'Accept': 'application/json' } })
+ .then(function (r) { return r.ok ? r.json() : null; })
+ .then(function (d) {
+ var v = (d && d.video) || {};
+ var yc = window.VideoYoutube, stats = [];
+ var lk = yc && yc.compactCount(v.like_count); if (lk) stats.push(lk + ' likes');
+ var vw = yc && yc.compactCount(v.view_count); if (vw) stats.push(vw + ' views');
+ panel.innerHTML = '' +
+ (stats.length ? '' : '') +
+ '
';
+ })
+ .catch(function () { panel.innerHTML = ''; });
+ return;
+ }
var tmdb = data && data.tmdb_id;
var parts = key.split('_');
if (!tmdb) { panel.innerHTML = ''; return; }
@@ -1227,12 +1296,188 @@
.catch(function () { showEpSyncing(false); });
}
+ // ── YouTube channel (rendered through the show pipeline) ──────────────────
+ // A channel = a "show": upload YEAR is a season, video an episode. Renders
+ // into the SHOW container (currentKind='show') with d.kind='channel' +
+ // d.source='youtube' driving every branch above. All TMDB-only sections
+ // auto-hide on empty channel data.
+ var ytVideoMap = {}; // youtube_id -> raw video (for wish add, main grid + playlists)
+
+ function ytProx(u) { return (window.VideoYoutube && u) ? VideoYoutube.img(u) : (u || ''); }
+
+ function ytToShow(resp) {
+ var ch = resp.channel || {};
+ var byYear = {};
+ ytVideoMap = {};
+ (ch.videos || []).forEach(function (v) {
+ ytVideoMap[v.youtube_id] = v;
+ var yr = (v.published_at && /^\d{4}/.test(v.published_at)) ? parseInt(v.published_at.slice(0, 4), 10) : 0;
+ (byYear[yr] = byYear[yr] || []).push(v);
+ });
+ var years = Object.keys(byYear).map(Number).sort(function (a, b) { return b - a; });
+ var seasons = years.map(function (yr) {
+ var vids = byYear[yr], poster = '';
+ for (var k = 0; k < vids.length; k++) { if (vids[k].thumbnail_url) { poster = ytProx(vids[k].thumbnail_url); break; } }
+ var eps = vids.map(function (v, i) {
+ return { episode_number: i + 1, title: v.title, overview: v.description || '',
+ air_date: v.published_at, owned: !!v.wished, has_still: false,
+ still_url: ytProx(v.thumbnail_url), youtube_id: v.youtube_id };
+ });
+ var wishedN = eps.filter(function (e) { return e.owned; }).length;
+ return { season_number: yr, title: yr ? String(yr) : 'Undated', poster_url: poster || ytProx(ch.avatar_url),
+ episode_owned: wishedN, episode_total: eps.length, episodes: eps };
+ });
+ return { kind: 'channel', source: 'youtube', id: ch.youtube_id, title: ch.title || 'Channel',
+ overview: ch.description || '', backdrop_url: ytProx(ch.banner_url), has_backdrop: !!ch.banner_url,
+ poster_url: ytProx(ch.avatar_url), has_poster: !!ch.avatar_url, genres: ch.tags || [], handle: ch.handle,
+ subscriber_count: ch.subscriber_count, video_count: ch.video_count, view_count: ch.view_count,
+ following: !!resp.following, _channel: ch, seasons: seasons, season_count: seasons.length,
+ episode_total: (ch.videos || []).length, episode_owned: 0 };
+ }
+
+ function loadChannel(id) {
+ currentKind = 'show'; currentSource = 'youtube'; // render into the show container
+ if (currentId !== id) artAttemptedFor = null;
+ currentId = id;
+ if (!root()) return;
+ showLoading(true); resetExtras(); showEpSyncing(false);
+ ['[data-vd-episodes]', '[data-vd-season-nav]'].forEach(function (s) { var n = q(s); if (n) n.innerHTML = ''; });
+ var r0 = root(); if (r0) r0.style.removeProperty('--vd-accent-rgb');
+ ytResetPlaylists();
+ fetch('/api/video/youtube/channel/' + encodeURIComponent(id) + '?limit=90', { headers: { 'Accept': 'application/json' } })
+ .then(function (r) { return r.ok ? r.json() : null; })
+ .then(function (resp) {
+ showLoading(false);
+ if (!resp || !resp.success) { setText('[data-vd-title]', 'Channel unavailable'); return; }
+ if (currentId !== id) return;
+ data = ytToShow(resp); menuOpen = false; missingOnly = false;
+ selectedSeason = data.seasons.length ? data.seasons[0].season_number : null;
+ var mt = q('[data-vd-missing-toggle]');
+ if (mt) { mt.hidden = !data.seasons.length; mt.classList.remove('vd-missing-toggle--on'); }
+ renderBillboard(data); renderViewToggle(); renderSeasonNav(); ensureSeasonEpisodes();
+ var sub = document.querySelector('.video-subpage[data-video-subpage="video-show-detail"]');
+ if (sub) sub.scrollTop = 0;
+ ytLoadPlaylists(id);
+ })
+ .catch(function () { showLoading(false); setText('[data-vd-title]', 'Could not load channel'); });
+ }
+
+ function ytFindEp(id) {
+ if (!data || !data.seasons) return null;
+ for (var i = 0; i < data.seasons.length; i++) {
+ var es = data.seasons[i].episodes;
+ for (var j = 0; j < es.length; j++) if (es[j].youtube_id === id) return es[j];
+ }
+ return null;
+ }
+
+ function toggleYtWish(btn) {
+ var yc = window.VideoYoutube; if (!yc) return;
+ var id = btn.getAttribute('data-vd-yt-wish');
+ var on = btn.classList.contains('vd-yt-wish--on');
+ btn.disabled = true;
+ var setOn = function (val) {
+ btn.disabled = false;
+ if (ytVideoMap[id]) ytVideoMap[id].wished = val;
+ var r0 = root(), btns = r0 ? r0.querySelectorAll('[data-vd-yt-wish="' + id + '"]') : [];
+ for (var i = 0; i < btns.length; i++) {
+ btns[i].classList.toggle('vd-yt-wish--on', val);
+ btns[i].textContent = val ? '✓ Wished' : '+ Wish';
+ }
+ var ep = ytFindEp(id); if (ep) { ep.owned = val; renderSeasonNav(); }
+ document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed'));
+ };
+ if (on) yc.removeWish('video', id).then(function (d) { setOn(!(d && d.success)); }).catch(function () { btn.disabled = false; });
+ else {
+ var ch = (data && data._channel) || {};
+ yc.addVideos({ youtube_id: ch.youtube_id, title: ch.title, avatar_url: ch.avatar_url },
+ [ytVideoMap[id] || { youtube_id: id, title: '' }])
+ .then(function (d) { setOn(!!(d && d.success)); if (d && d.success && typeof showToast === 'function') showToast('Added to wishlist', 'success'); })
+ .catch(function () { btn.disabled = false; });
+ }
+ }
+
+ function toggleYtFollow() {
+ var yc = window.VideoYoutube; if (!yc || !data) return;
+ var ch = data._channel || {}, on = data.following;
+ if (on) yc.unfollow(data.id).then(function () { data.following = false; renderActions(data);
+ document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed')); }).catch(function () { /* ignore */ });
+ else yc.follow({ youtube_id: ch.youtube_id, title: ch.title, avatar_url: ch.avatar_url }).then(function (d) {
+ if (d && d.success) {
+ if (typeof showToast === 'function') showToast('Following · ' + (d.added_videos || 0) + ' videos added', 'success');
+ document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed'));
+ loadChannel(data.id); // reload so the now-wished videos reflect
+ }
+ }).catch(function () { /* ignore */ });
+ }
+
+ // playlists as collapsible rows below the episodes (channel-only section)
+ function ytResetPlaylists() {
+ var sec = q('[data-vd-yt-pl-section]'), host = q('[data-vd-yt-playlists]');
+ if (host) host.innerHTML = '';
+ if (sec) sec.hidden = true;
+ }
+ function ytPlaylistRow(p) {
+ var thumb = p.thumbnail_url
+ ? ' '
+ : '▶ ';
+ var n = p.video_count != null ? p.video_count + ' video' + (p.video_count === 1 ? '' : 's') : '';
+ return '' +
+ '
' + thumb +
+ '
' + esc(p.title) + ' ' +
+ (n ? '' + n + ' ' : '') + '
' +
+ '
▾ ' +
+ '
';
+ }
+ function ytLoadPlaylists(cid) {
+ var sec = q('[data-vd-yt-pl-section]'), host = q('[data-vd-yt-playlists]');
+ if (!host) return;
+ fetch('/api/video/youtube/playlists/' + encodeURIComponent(cid), { headers: { Accept: 'application/json' } })
+ .then(function (r) { return r.ok ? r.json() : null; })
+ .then(function (d) {
+ var pls = (d && d.playlists) || [];
+ if (!pls.length || currentId !== cid) return;
+ host.innerHTML = pls.map(ytPlaylistRow).join('');
+ if (sec) sec.hidden = false;
+ })
+ .catch(function () { /* best-effort */ });
+ }
+ function ytPlVideoCard(v) {
+ ytVideoMap[v.youtube_id] = v;
+ var thumb = v.thumbnail_url
+ ? ' ' : '';
+ return '' +
+ '
' + thumb + '▶ ' +
+ '
' + esc(v.title || 'Untitled') + '
' +
+ '
' + (v.wished ? '✓' : '+') + ' ';
+ }
+ function toggleYtPlaylist(el) {
+ var pid = el.getAttribute('data-vd-yt-pl-toggle');
+ var blk = el.closest('.vc-pl'); if (!blk) return;
+ var opened = blk.classList.toggle('vc-pl--collapsed') === false;
+ if (!opened) return;
+ var host = q('[data-vd-yt-pl-vids="' + pid + '"]');
+ if (!host || host.getAttribute('data-loaded')) return;
+ host.setAttribute('data-loaded', '1');
+ host.innerHTML = 'Loading…
';
+ fetch('/api/video/youtube/playlist/' + encodeURIComponent(pid), { headers: { Accept: 'application/json' } })
+ .then(function (r) { return r.ok ? r.json() : null; })
+ .then(function (d) {
+ var vids = (d && d.videos) || [];
+ host.innerHTML = vids.length ? vids.map(ytPlVideoCard).join('') : 'No videos.
';
+ })
+ .catch(function () { host.removeAttribute('data-loaded'); host.innerHTML = ''; });
+ }
+
// ── events ────────────────────────────────────────────────────────────────
function onOpen(e) {
if (!e || !e.detail) return;
var src = e.detail.source || 'library';
if (e.detail.kind === 'movie') loadMovie(e.detail.id, src);
else if (e.detail.kind === 'show') loadShow(e.detail.id, src);
+ else if (e.detail.kind === 'channel') loadChannel(e.detail.id);
// 'person' is handled by video-person.js (same event).
}
@@ -1277,6 +1522,12 @@
if (body) { var open = body.classList.toggle('vd-review-body--open'); revMore.textContent = open ? 'Read less' : 'Read more'; }
return;
}
+ // YouTube channel interactions (rendered in the show container)
+ if (e.target.closest('[data-vd-ext]')) return; // let watch links open
+ var ytWish = e.target.closest('[data-vd-yt-wish]');
+ if (ytWish && r.contains(ytWish)) { e.preventDefault(); toggleYtWish(ytWish); return; }
+ var ytPl = e.target.closest('[data-vd-yt-pl-toggle]');
+ if (ytPl && r.contains(ytPl)) { toggleYtPlaylist(ytPl); return; }
var epRow = e.target.closest('[data-vd-ep-key]');
if (epRow && r.contains(epRow)) { toggleEpisode(epRow); return; }
var seasonBtn = e.target.closest('[data-vd-season]');
@@ -1290,6 +1541,7 @@
var which = act.getAttribute('data-vd-act');
if (which === 'watchlist') toggleWatchlist();
else if (which === 'missing') toggleMissing();
+ else if (which === 'yt-follow') toggleYtFollow();
else if (which === 'trailer' && data && data.trailer) openTrailer(data.trailer.key);
return;
}
diff --git a/webui/static/video/video-side.css b/webui/static/video/video-side.css
index a53a27fd..4456909c 100644
--- a/webui/static/video/video-side.css
+++ b/webui/static/video/video-side.css
@@ -2933,3 +2933,30 @@ body[data-side="video"] #soulsync-toggle { display: none; }
.vyt-result-title { font-size: 13px; font-weight: 800; color: #fff; line-height: 1.2; max-width: 100%;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vyt-result-sub { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.42); }
+
+/* ── YouTube channel rendered through the SHOW detail page (.vd-yt-*) ───────── */
+.vd-status--yt { background: rgba(255,59,59,0.18); color: #ff8a8a; }
+.vd-yt-follow { border: 0; cursor: pointer; border-radius: 999px; padding: 11px 24px; font-size: 13.5px; font-weight: 800;
+ background: #ff3b3b; color: #fff; box-shadow: 0 8px 22px rgba(255,59,59,0.4); transition: all 0.15s ease; }
+.vd-yt-follow:hover { transform: translateY(-1px); background: #ff5252; }
+.vd-yt-follow--on { background: rgba(255,255,255,0.12); color: #6cd391; box-shadow: none; }
+.vd-yt-link { display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; color: #ff6b6b;
+ text-decoration: none; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(255,59,59,0.35); }
+.vd-yt-link:hover { background: rgba(255,59,59,0.12); }
+.vd-section-h { font-size: 20px; font-weight: 800; color: #fff; margin: 0 0 16px; }
+.vd-yt-pl-section { margin-top: 34px; }
+/* per-video Wish button inside an episode row */
+.vd-yt-wish { flex-shrink: 0; align-self: center; border: 1px solid rgba(255,255,255,0.14); cursor: pointer;
+ background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.78); font-size: 11.5px; font-weight: 800;
+ padding: 6px 13px; border-radius: 999px; transition: all 0.15s ease; white-space: nowrap; }
+.vd-yt-wish:hover { background: rgba(255,59,59,0.18); border-color: rgba(255,59,59,0.5); color: #fff; }
+.vd-yt-wish--on { background: rgba(108,211,145,0.16); border-color: rgba(108,211,145,0.4); color: #6cd391; }
+/* playlist video chips */
+.vd-yt-plvid { display: flex; flex-direction: column; }
+.vd-yt-plvid-thumb { position: relative; display: block; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; background: #16161d; }
+.vd-yt-plvid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
+.vd-yt-plvid-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; opacity: 0; transition: opacity 0.2s ease; }
+.vd-yt-plvid-thumb:hover .vd-yt-plvid-play { opacity: 0.9; }
+.vd-yt-plvid-title { font-size: 12px; font-weight: 700; color: #fff; line-height: 1.3; margin-top: 7px;
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+.vd-yt-plvid .vd-yt-wish { align-self: flex-start; margin-top: 7px; }
diff --git a/webui/static/video/video-side.js b/webui/static/video/video-side.js
index 65a26edc..2743a4cb 100644
--- a/webui/static/video/video-side.js
+++ b/webui/static/video/video-side.js
@@ -31,8 +31,7 @@
// reload / Back / Forward / open-in-new-tab all work. ``source`` is 'library'
// (a video.db id) today; 'tmdb' (a search result not yet in the library) later.
var DETAIL_BASE = '/video-detail/';
- var DETAIL_PAGES = { 'video-show-detail': 1, 'video-movie-detail': 1, 'video-person-detail': 1,
- 'video-channel-detail': 1 };
+ var DETAIL_PAGES = { 'video-show-detail': 1, 'video-movie-detail': 1, 'video-person-detail': 1 };
function buildDetailPath(source, kind, id) {
return DETAIL_BASE + encodeURIComponent(source || 'library') + '/' + kind + '/' + encodeURIComponent(id);
@@ -70,10 +69,6 @@
var n = document.querySelector('[data-video-person] [data-vp-name]');
return n ? (n.textContent || '').trim() : '';
}
- if (pageId === 'video-channel-detail') {
- var cn = document.querySelector('[data-video-channel] [data-vc-name]');
- return cn ? (cn.textContent || '').trim() : '';
- }
var host = pageId === 'video-movie-detail' ? '[data-video-detail="movie"]' : '[data-video-detail="show"]';
var t = document.querySelector(host + ' [data-vd-title]');
return t ? (t.textContent || '').trim() : '';
@@ -145,7 +140,6 @@
{ id: 'video-show-detail', label: 'Show' },
{ id: 'video-movie-detail', label: 'Movie' },
{ id: 'video-person-detail', label: 'Person' },
- { id: 'video-channel-detail', label: 'Channel' },
];
// "Shared" video pages reuse the REAL music page (shown identically on the
@@ -313,7 +307,7 @@
if (d.kind === 'movie') navigate('video-movie-detail');
else if (d.kind === 'show') navigate('video-show-detail');
else if (d.kind === 'person') navigate('video-person-detail');
- else if (d.kind === 'channel') navigate('video-channel-detail');
+ else if (d.kind === 'channel') navigate('video-show-detail'); // channels reuse the show detail page
else return;
if (d._replace) {
// A redirect (e.g. a tmdb link that's actually owned) → replace the