This commit is contained in:
1 parent
d266a8258d
commit
774200fb39
4 files changed
+38
-15
No files matched your search
@@ -55,9 +55,10 @@ Voeg daarna in je IPTV-client toe:
|
||||
| `GET /health` | Healthcheck voor Docker |
|
||||
| `GET /` | Eenvoudige statuspagina |
|
||||
|
||||
De playlist bevat altijd `Jupiler 1` t/m `Jupiler 3`. Is een slot leeg, dan heet het
|
||||
`Jupiler N | Geen wedstrijd` en geeft `/stream/N` een 503 tot er een wedstrijd op het slot
|
||||
staat.
|
||||
De playlist bevat altijd exact dezelfde drie kanalen: `Jupiler 1`, `Jupiler 2` en
|
||||
`Jupiler 3`, met vaste `tvg-id`, `tvg-name` en `tvg-chno`. De kanaalnaam verandert nooit;
|
||||
de actuele wedstrijd staat in de EPG en op `/status`. Is een slot leeg, dan geeft
|
||||
`/stream/N` een 503 tot er een wedstrijd op het slot staat.
|
||||
|
||||
## Configuratie
|
||||
|
||||
|
||||
@@ -9,12 +9,9 @@ function buildPlaylist(req, scheduler) {
|
||||
const count = scheduler.getSlotCount();
|
||||
const lines = ['#EXTM3U'];
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const event = scheduler.getSlotEvent(i);
|
||||
const label = event
|
||||
? `${event.title} (${formatLocalTime(event.startAt, settings.timezone)})`
|
||||
: 'Geen wedstrijd';
|
||||
const name = `Jupiler ${i + 1}`;
|
||||
lines.push(
|
||||
`#EXTINF:-1 tvg-id="jupiler-${i + 1}" tvg-name="Jupiler ${i + 1}",Jupiler ${i + 1} | ${label}`
|
||||
`#EXTINF:-1 tvg-id="jupiler-${i + 1}" tvg-name="${name}" tvg-chno="${i + 1}",${name}`
|
||||
);
|
||||
lines.push(`${origin}/stream/${i + 1}`);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,34 @@ test('playlist always contains three fixed channels', () => {
|
||||
assert.equal(lines[0], '#EXTM3U');
|
||||
assert.equal(
|
||||
lines[1],
|
||||
'#EXTINF:-1 tvg-id="jupiler-1" tvg-name="Jupiler 1",Jupiler 1 | Standard de Liège - SK Beveren (19:25)'
|
||||
'#EXTINF:-1 tvg-id="jupiler-1" tvg-name="Jupiler 1" tvg-chno="1",Jupiler 1'
|
||||
);
|
||||
assert.equal(lines[2], 'http://example.test:8080/stream/1');
|
||||
assert.ok(body.includes('Jupiler 2 | Geen wedstrijd'));
|
||||
assert.ok(body.includes('Jupiler 3 | Geen wedstrijd'));
|
||||
assert.ok(body.includes('#EXTINF:-1 tvg-id="jupiler-2" tvg-name="Jupiler 2" tvg-chno="2",Jupiler 2'));
|
||||
assert.ok(body.includes('#EXTINF:-1 tvg-id="jupiler-3" tvg-name="Jupiler 3" tvg-chno="3",Jupiler 3'));
|
||||
assert.ok(body.includes('http://example.test:8080/stream/3'));
|
||||
});
|
||||
|
||||
test('channel metadata stays identical when the assigned event changes', () => {
|
||||
const first = {
|
||||
getSlotCount: () => 3,
|
||||
getSlotEvent: (index) => (index === 0 ? event : null),
|
||||
};
|
||||
const second = {
|
||||
getSlotCount: () => 3,
|
||||
getSlotEvent: (index) =>
|
||||
index === 0
|
||||
? {
|
||||
key: 'b',
|
||||
title: 'Anderlecht - Genk',
|
||||
startAt: new Date('2026-11-06T21:00:00Z'),
|
||||
endAt: new Date('2026-11-06T23:30:00Z'),
|
||||
}
|
||||
: null,
|
||||
};
|
||||
const channelLines = (body) => body.split('\n').filter((line) => line.startsWith('#EXTINF'));
|
||||
assert.deepEqual(
|
||||
channelLines(buildPlaylist(fakeRequest(), first)),
|
||||
channelLines(buildPlaylist(fakeRequest(), second))
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user