mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
wip
This commit is contained in:
parent
0a33284308
commit
af41021b99
2 changed files with 2 additions and 2 deletions
22
scripts/commands/update-database.js
Normal file
22
scripts/commands/update-database.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
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(p => {
|
||||
p.site = result.site
|
||||
return p
|
||||
})
|
||||
db.programs.insert(programs)
|
||||
})
|
||||
}
|
||||
db.programs.compact()
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue