mirror of
https://github.com/iptv-org/iptv.git
synced 2026-11-25 17:51:16 +02:00
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:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user