From c96d3eea101942c46d2c164cc93fb6fac8b8ee23 Mon Sep 17 00:00:00 2001 From: leoca Date: Sat, 17 Oct 2026 13:40:28 +0000 Subject: [PATCH] fix: keep stream titles when playlist:edit saves the file playlist:edit saved the playlist without the raw option, so every title was rebuilt from the API channel name and country instead of being written back as read. For a stream whose channel is not in the database, that becomes "undefined (undefined)". playlist:format, playlist:update and playlist:test already save with { public: false, raw: true }. --- scripts/commands/playlist/edit.ts | 2 +- tests/commands/playlist/edit.test.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/commands/playlist/edit.ts b/scripts/commands/playlist/edit.ts index 43740946c9..bb893364c9 100644 --- a/scripts/commands/playlist/edit.ts +++ b/scripts/commands/playlist/edit.ts @@ -189,7 +189,7 @@ function getFeedChoises(feeds: Collection): Choice[] { function save(filepath: string) { if (!storage.existsSync(filepath)) return - const playlist = new Playlist(parsedStreams) + const playlist = new Playlist(parsedStreams, { public: false, raw: true }) storage.saveSync(filepath, playlist.toString()) logger.info(`\nFile '${filepath}' successfully saved`) } diff --git a/tests/commands/playlist/edit.test.ts b/tests/commands/playlist/edit.test.ts index 15f385dae3..c4157b2850 100644 --- a/tests/commands/playlist/edit.test.ts +++ b/tests/commands/playlist/edit.test.ts @@ -30,6 +30,19 @@ describe('playlist:edit', () => { checkStdout((error as ExecError).stdout) } }) + + it('keeps the stream titles when saving the playlist', () => { + const cmd = `${ENV_VAR} npm run playlist:edit --- tests/__data__/output/playlist.m3u` + try { + execSync(cmd, { encoding: 'utf8' }) + } catch { + // NOTE: for Windows only + } + + const content = fs.readFileSync('tests/__data__/output/playlist.m3u', 'utf8') + expect(content).toContain('tvg-id="HewadTV.af",Hewad TV (720p) [Not 24/7]') + expect(content).toContain('tvg-id="",Télévision française 1 (480p)') + }) }) function checkStdout(stdout: string) {