fix: rewrite playlists whose only streams were duplicates in playlist:format

playlist:format drops duplicate links across all files, then saves each file that still has streams. A file whose streams were all duplicates of links in other files was never saved, so it kept the duplicate (and the unnormalized link) as it was.
This commit is contained in:
Leo Camus
2026-11-22 02:00:15 +00:00
parent f0e15d972a
commit c674b75a3b
4 changed files with 23 additions and 4 deletions
+2 -4
View File
@@ -58,6 +58,7 @@ async function main() {
})
logger.info('removing duplicates...')
const filepaths = streams.map((stream: Stream) => stream.getFilepath()).uniq()
streams = streams.uniqBy(stream => stream.url)
logger.info('removing wrong id...')
@@ -115,11 +116,8 @@ async function main() {
logger.info('saving...')
const groupedStreams = streams.groupBy((stream: Stream) => stream.getFilepath())
for (const filepath of groupedStreams.keys()) {
for (const filepath of filepaths.all()) {
const streams = new Collection(groupedStreams.get(filepath))
if (streams.isEmpty()) return
const playlist = new Playlist(streams, { public: false, raw: true })
await streamsStorage.save(filepath, playlist.toString())
}