Fixes missing programs list

This commit is contained in:
freearhey 2021-04-18 15:10:58 +03:00
parent d6c1f680c2
commit 4e5f73519a
1 changed files with 10 additions and 11 deletions

View File

@ -33,7 +33,7 @@ async function main() {
console.log('Parsing:') console.log('Parsing:')
for (let item of queue) { for (let item of queue) {
if (options.debug) console.time(' Response Time') if (options.debug) console.time(' Response Time')
const progs = await utils await utils
.fetchData(item, config) .fetchData(item, config)
.then(response => { .then(response => {
if (options.debug) { if (options.debug) {
@ -48,17 +48,18 @@ async function main() {
}) })
} }
const programs = utils.parsePrograms({ response, item, config }) const parsed = utils.parsePrograms({ response, item, config }).map(program => {
console.log(
` ${config.site} - ${item.channel.xmltv_id} - ${item.date.format('MMM D, YYYY')} (${
programs.length
} programs)`
)
return programs.map(program => {
program.lang = program.lang || item.channel.lang || undefined program.lang = program.lang || item.channel.lang || undefined
return program return program
}) })
console.log(
` ${config.site} - ${item.channel.xmltv_id} - ${item.date.format('MMM D, YYYY')} (${
parsed.length
} programs)`
)
programs = programs.concat(parsed)
}) })
.then(() => { .then(() => {
if (options.debug) console.timeEnd(' Parsing Time') if (options.debug) console.timeEnd(' Parsing Time')
@ -76,8 +77,6 @@ async function main() {
console.timeEnd(' Parsing Time') console.timeEnd(' Parsing Time')
} }
}) })
programs = programs.concat(progs)
} }
const xml = utils.convertToXMLTV({ config, channels, programs }) const xml = utils.convertToXMLTV({ config, channels, programs })