Update index.js
This commit is contained in:
parent
e11bc75391
commit
2a28c59fb9
13
src/index.js
13
src/index.js
|
@ -14,7 +14,6 @@ const Result = {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
grab: async function (channel, config, cb) {
|
grab: async function (channel, config, cb) {
|
||||||
cb(Result)
|
|
||||||
const utcDate = utils.getUTCDate()
|
const utcDate = utils.getUTCDate()
|
||||||
const dates = Array.from({ length: config.days }, (_, i) => utcDate.add(i, 'd'))
|
const dates = Array.from({ length: config.days }, (_, i) => utcDate.add(i, 'd'))
|
||||||
const queue = []
|
const queue = []
|
||||||
|
@ -32,15 +31,17 @@ module.exports = {
|
||||||
.then(response => utils.parseResponse(item, response, config))
|
.then(response => utils.parseResponse(item, response, config))
|
||||||
.then(results => {
|
.then(results => {
|
||||||
item.programs = results
|
item.programs = results
|
||||||
Result.events['data'](item)
|
cb(item, null)
|
||||||
programs = programs.concat(results)
|
programs = programs.concat(results)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
Result.events['error'](err)
|
cb(null, err)
|
||||||
})
|
})
|
||||||
.finally(utils.sleep(config.delay))
|
|
||||||
|
await utils.sleep(config.delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
Result.events['done'](programs)
|
return programs
|
||||||
}
|
},
|
||||||
|
convertToXMLTV: utils.convertToXMLTV
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue