diff --git a/docs-site/jellyfin-integration.md b/docs-site/jellyfin-integration.md index 431407f8..981ffb19 100644 --- a/docs-site/jellyfin-integration.md +++ b/docs-site/jellyfin-integration.md @@ -31,7 +31,7 @@ Casting finds mpv through `mpv.executablePath`, then `SUBMINER_MPV_PATH`, then ` When you play an episode, by casting or from the terminal, SubMiner adds the episodes around it from the same series to mpv's playlist. Move between them with mpv's playlist keys (`<` and `>` by default) or your playlist UI, and mpv moves on to the next episode when one ends. The series order runs across seasons. Each switch happens in the running mpv and overlay; nothing restarts. -SubMiner waits until the first episode is playing before it looks up the others, so startup is no slower. Every episode you switch to resumes from Jellyfin's saved position and reports progress like one you picked yourself. Its subtitles load the same way. +SubMiner waits until the first episode is playing before it looks up the others, so startup is no slower. Every episode you switch to resumes from Jellyfin's saved position and reports progress like one you picked yourself. Its subtitles load the same way. With mpv 0.42 or newer, the playlist lists the queued episodes by title; older mpv versions show their stream URLs. `episodePlaylist.maxEpisodes` caps how many episodes the playlist holds, centered on the playing one. Turn `episodePlaylist.enabled` off to play one episode at a time. Changes apply from the next episode switch. diff --git a/e2e/jellyfin.e2e.test.ts b/e2e/jellyfin.e2e.test.ts index 6d138f74..08d34911 100644 --- a/e2e/jellyfin.e2e.test.ts +++ b/e2e/jellyfin.e2e.test.ts @@ -32,6 +32,13 @@ async function playlistIds(mpv: E2eSession['mpv']): Promise { }); } +// `playlist/N/title` is writable from mpv 0.42. +async function supportsPlaylistTitles(mpv: E2eSession['mpv']): Promise { + const version = String(await mpv.command('get_property', 'mpv-version')); + const [major = 0, minor = 0] = (/v?(\d+)\.(\d+)/.exec(version) ?? []).slice(1).map(Number); + return major > 0 || minor >= 42; +} + async function mainPid(started: E2eSession): Promise { const main = await started.mainProcess(); try { @@ -83,19 +90,25 @@ test( description: 'Jellyfin to hear ep2 start', timeoutMs: 30_000, }); - // mpv's playlist lists entry titles, not stream URLs carrying the API key. + // mpv's playlist lists entry titles, not stream URLs carrying the API key. Entry titles + // became writable in mpv 0.42; older players keep listing URLs. const titles = [ 'E2E Show S01E01 Episode 1', 'E2E Show S01E02 Episode 2', 'E2E Show S01E03 Episode 3', ]; - await waitUntil( - async () => { - const playlist = (await mpv.command('get_property', 'playlist')) as PlaylistEntry[]; - return playlist.map((entry) => entry.title).join('|') === titles.join('|'); - }, - { description: 'queued playlist entries titled like the playing episode', timeoutMs: 10_000 }, - ); + if (await supportsPlaylistTitles(mpv)) { + await waitUntil( + async () => { + const playlist = (await mpv.command('get_property', 'playlist')) as PlaylistEntry[]; + return playlist.map((entry) => entry.title).join('|') === titles.join('|'); + }, + { + description: 'queued playlist entries titled like the playing episode', + timeoutMs: 10_000, + }, + ); + } await mpv.command('playlist-next'); await waitUntil(() => reported('playing', 'ep3') >= 0, {