mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Rename to save-results.js
This commit is contained in:
parent
fed1c63f80
commit
8094f1dbb6
2 changed files with 2 additions and 2 deletions
24
scripts/commands/save-results.js
Normal file
24
scripts/commands/save-results.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const { db, logger, file, parser } = require('../core')
|
||||
const _ = require('lodash')
|
||||
|
||||
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs'
|
||||
|
||||
async function main() {
|
||||
await db.programs.reset()
|
||||
const files = await file.list(`${LOGS_DIR}/load-cluster/cluster_*.log`)
|
||||
for (const filepath of files) {
|
||||
const results = await parser.parseLogs(filepath)
|
||||
results.forEach(result => {
|
||||
const programs = result.programs.map(program => {
|
||||
program.site = result.site
|
||||
program.country = result.country
|
||||
|
||||
return program
|
||||
})
|
||||
db.programs.insert(programs)
|
||||
})
|
||||
}
|
||||
db.programs.compact()
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue