From c7d9cf8356c8f90de80cda85897ad7c08bf8c392 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 8 Jan 2023 12:43:58 +0300 Subject: [PATCH] Update validate.js --- scripts/commands/guides/validate.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/commands/guides/validate.js b/scripts/commands/guides/validate.js index bad9d188..79ce13b5 100644 --- a/scripts/commands/guides/validate.js +++ b/scripts/commands/guides/validate.js @@ -19,11 +19,19 @@ async function main() { const errors = [] - let programs = db_programs.map(p => ({ - site: p.site, - xmltv_id: p.channel, - lang: p.titles[0].lang - })) + let programs = db_programs + .map(p => { + if (p.titles.length) { + return { + site: p.site, + xmltv_id: p.channel, + lang: p.titles[0].lang + } + } + + return null + }) + .filter(Boolean) programs = _.uniqBy(programs, p => p.site + p.xmltv_id) for (let program of programs) { if (!guides.find(g => g.channel === program.xmltv_id)) {