From fae74f4e2c5e3e513f5a1f481c1cad027766357f Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 1 May 2023 21:13:50 +0300 Subject: [PATCH] Update validate.js --- scripts/commands/playlist/validate.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/commands/playlist/validate.js b/scripts/commands/playlist/validate.js index 2b1b4badb..15ee4a73e 100644 --- a/scripts/commands/playlist/validate.js +++ b/scripts/commands/playlist/validate.js @@ -30,6 +30,7 @@ async function main() { const basename = file.basename(filepath) const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null] + const buffer = {} const fileLog = [] const playlist = await parser.parsePlaylist(filepath) for (const item of playlist.items) { @@ -41,6 +42,16 @@ async function main() { }) } + if (item.url && buffer[item.url]) { + fileLog.push({ + type: 'warning', + line: item.line, + message: `"${item.url}" is already on the playlist` + }) + } else { + buffer[item.url] = true + } + const channel_id = id.generate(item.name, country) const found = blocklist.find( blocked =>