mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update save-results.js
This commit is contained in:
parent
309294988b
commit
e6fbc34aab
3 changed files with 51 additions and 50 deletions
|
@ -6,7 +6,7 @@ const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs'
|
|||
async function main() {
|
||||
const errorsLog = `${LOGS_DIR}/errors.log`
|
||||
await file.create(errorsLog)
|
||||
await db.channels.load()
|
||||
await db.queue.load()
|
||||
await db.programs.load()
|
||||
await db.programs.reset()
|
||||
const files = await file.list(`${LOGS_DIR}/load-cluster/cluster_*.log`)
|
||||
|
@ -32,12 +32,10 @@ async function main() {
|
|||
})
|
||||
await db.programs.insert(programs)
|
||||
|
||||
if (result.channel.logo) {
|
||||
await db.channels.update(
|
||||
{ _id: result.channel._id },
|
||||
{ $set: { logo: result.channel.logo, programCount: result.programs.length } }
|
||||
)
|
||||
}
|
||||
await db.queue.update(
|
||||
{ _id: result.channel._id },
|
||||
{ $set: { programCount: result.programs.length } }
|
||||
)
|
||||
|
||||
if (result.error) {
|
||||
await file.append(
|
||||
|
@ -48,7 +46,7 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
await db.channels.compact()
|
||||
await db.queue.compact()
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue