Update validate.js

pull/12654/head
Aleksandr Statciuk 2 years ago
parent 39ef19b716
commit fae74f4e2c

@ -30,6 +30,7 @@ async function main() {
const basename = file.basename(filepath) const basename = file.basename(filepath)
const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null] const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null]
const buffer = {}
const fileLog = [] const fileLog = []
const playlist = await parser.parsePlaylist(filepath) const playlist = await parser.parsePlaylist(filepath)
for (const item of playlist.items) { 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 channel_id = id.generate(item.name, country)
const found = blocklist.find( const found = blocklist.find(
blocked => blocked =>

Loading…
Cancel
Save