fix(jellyfin): keep playback armed across file unload and serialize episode stops

- An empty mpv path during the startup grace belongs to the file being
  replaced, so it no longer clears the new, not-yet-loaded playback. This
  dropped Jellyfin reporting (and the episode queue) whenever playback
  started while another file was playing, and failed E2E on all CI runners.
- Chain superseded stop reports so each episode start waits for every
  earlier stop, and skip starts a later switch already took over.
- Tag tracked reports with their playback so a superseded stop drains only
  its own in-flight progress, not the new episode's.
- E2E: clamp the fake server's range end and wait for the ep2 start report.
This commit is contained in:
sudacode committed 2026-11-23 01:36:01 -08:00
1 parent c742e9541c
commit ec98118006
7 files changed
+153 -63

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ function serveFile(request: http.IncomingMessage, response: http.ServerResponse,
const size = fs.statSync(file).size;
const range = /^bytes=(\d+)-(\d*)$/.exec(request.headers.range ?? '');
const start = range ? Number(range[1]) : 0;
const end = range?.[2] ? Number(range[2]) : size - 1;
const end = Math.min(range?.[2] ? Number(range[2]) : size - 1, size - 1);
response.writeHead(range ? 206 : 200, {
'content-type': 'video/x-matroska',
'accept-ranges': 'bytes',
+5 -1
View File
@@ -78,7 +78,11 @@ test(
description: 'the episodes around ep2 queued in the mpv playlist',
timeoutMs: 30_000,
});
assert.ok(reported('playing', 'ep2') >= 0, 'Jellyfin hears ep2 start');
// The start report is fire-and-forget, so it can land after the playlist fills.
await waitUntil(() => reported('playing', 'ep2') >= 0, {
description: 'Jellyfin to hear ep2 start',
timeoutMs: 30_000,
});
// mpv's playlist lists entry titles, not stream URLs carrying the API key.
const titles = [
'E2E Show S01E01 Episode 1',