From a1f32e1d23511629315c782b1d25850caf760901 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 27 Oct 2022 20:27:54 +0300 Subject: [PATCH] Update update.js --- scripts/commands/guides/update.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index f94ef9ea..31cd43fc 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -85,8 +85,9 @@ async function main() { } programs = _.flatten(Object.values(programs)) - programs = programs = _.sortBy(programs, ['channel', 'start']) - programs = programs.map(p => new Program(p, new Channel(channels_dic[p.channel]))) + + if (!programs.length) continue + let channels = programs.map(p => { let c = channels_dic[p.channel] c.site = p.site @@ -97,6 +98,9 @@ async function main() { channels = _.sortBy(channels, 'id') channels = _.uniqBy(channels, 'id') + programs = programs = _.sortBy(programs, ['channel', 'start']) + programs = programs.map(p => new Program(p, new Channel(channels_dic[p.channel]))) + const filename = country.code.toLowerCase() const xmlFilepath = `${PUBLIC_DIR}/guides/${filename}.xml` const gzFilepath = `${PUBLIC_DIR}/guides/${filename}.xml.gz`