Update epg-grabber.js

This commit is contained in:
Aleksandr Statciuk 2022-01-31 05:48:01 +03:00
parent 42434c40cd
commit cdf2a39882
1 changed files with 17 additions and 13 deletions

View File

@ -85,9 +85,12 @@ async function main() {
let i = 1 let i = 1
let days = options.days || 1 let days = options.days || 1
const total = channels.length * days const total = channels.length * days
const utcDate = utils.getUTCDate()
const dates = Array.from({ length: config.days }, (_, i) => utcDate.add(i, 'd'))
for (let channel of channels) { for (let channel of channels) {
for (let date of dates) {
await grabber await grabber
.grab(channel, config, (data, err) => { .grab(channel, date, config, (data, err) => {
logger.info( logger.info(
`[${i}/${total}] ${config.site} - ${data.channel.xmltv_id} - ${data.date.format( `[${i}/${total}] ${config.site} - ${data.channel.xmltv_id} - ${data.date.format(
'MMM D, YYYY' 'MMM D, YYYY'
@ -102,6 +105,7 @@ async function main() {
programs = programs.concat(results) programs = programs.concat(results)
}) })
} }
}
const xml = utils.convertToXMLTV({ config, channels, programs }) const xml = utils.convertToXMLTV({ config, channels, programs })
const outputPath = options.output || config.output || 'guide.xml' const outputPath = options.output || config.output || 'guide.xml'