Update grab.js

This commit is contained in:
Aleksandr Statciuk 2021-10-06 21:31:51 +03:00
parent eef60a1b9d
commit 9e61fec007

View file

@ -16,6 +16,7 @@ const options = program.opts()
async function main() { async function main() {
console.log('Starting...') console.log('Starting...')
console.time('Done in')
const buffer = {} const buffer = {}
const channels = parseChannels(options.channels).filter(channel => { const channels = parseChannels(options.channels).filter(channel => {
@ -46,13 +47,16 @@ async function main() {
.then(results => { .then(results => {
programs = programs.concat(results) programs = programs.concat(results)
}) })
.catch(err => {
console.log(` Error: ${err.message}`)
})
} }
const xml = grabber.convertToXMLTV({ channels, programs }) const xml = grabber.convertToXMLTV({ channels, programs })
writeToFile(options.output, xml) writeToFile(options.output, xml)
console.log(`File '${options.output}' successfully saved`) console.log(`File '${options.output}' successfully saved`)
console.log('Finish') console.timeEnd(`Done in`)
return true return true
} }