Update validate.js

This commit is contained in:
Aleksandr Statciuk 2023-05-15 19:12:55 +03:00
parent 33f08be1f3
commit 4a5cea8a72

View file

@ -26,27 +26,27 @@ async function main() {
const bufferBySiteId = {} const bufferBySiteId = {}
const errors = [] const errors = []
for (const channel of channels) { for (const channel of channels) {
if (!bufferById[channel.id + channel.lang]) { if (!bufferById[channel.xmltv_id + channel.lang]) {
bufferById[channel.id + channel.lang] = channel bufferById[channel.xmltv_id + channel.lang] = channel
} else { } else {
errors.push({ type: 'duplicate', xmltv_id: channel.id, ...channel }) errors.push({ type: 'duplicate', ...channel })
stats.errors++ stats.errors++
} }
if (!bufferBySiteId[channel.site_id + channel.lang]) { if (!bufferBySiteId[channel.site_id + channel.lang]) {
bufferBySiteId[channel.site_id + channel.lang] = channel bufferBySiteId[channel.site_id + channel.lang] = channel
} else { } else {
errors.push({ type: 'duplicate', xmltv_id: channel.id, ...channel }) errors.push({ type: 'duplicate', ...channel })
stats.errors++ stats.errors++
} }
if (!api.channels.find({ id: channel.id })) { if (!api.channels.find({ id: channel.xmltv_id })) {
errors.push({ type: 'wrong_xmltv_id', xmltv_id: channel.id, ...channel }) errors.push({ type: 'wrong_xmltv_id', ...channel })
stats.errors++ stats.errors++
} }
if (!langs.where('1', channel.lang)) { if (!langs.where('1', channel.lang)) {
errors.push({ type: 'wrong_lang', xmltv_id: channel.id, ...channel }) errors.push({ type: 'wrong_lang', ...channel })
stats.errors++ stats.errors++
} }
} }