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
c034f001e8
commit
76d2b10b5c
2 changed files with 19 additions and 0 deletions
|
@ -4,6 +4,8 @@ const _ = require('lodash')
|
|||
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs'
|
||||
|
||||
async function main() {
|
||||
await db.channels.load()
|
||||
|
||||
await db.programs.load()
|
||||
await db.programs.reset()
|
||||
const files = await file.list(`${LOGS_DIR}/load-cluster/cluster_*.log`)
|
||||
|
@ -11,6 +13,8 @@ async function main() {
|
|||
logger.info(`Parsing "${filepath}"...`)
|
||||
const results = await parser.parseLogs(filepath)
|
||||
for (const result of results) {
|
||||
await db.channels.update({ _id: result._id }, { $set: { logo: result.logo } })
|
||||
|
||||
const programs = result.programs.map(program => {
|
||||
program.site = result.site
|
||||
program.country = result.country
|
||||
|
@ -22,6 +26,8 @@ async function main() {
|
|||
await db.programs.insert(programs)
|
||||
}
|
||||
}
|
||||
|
||||
await db.channels.compact()
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue