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`