Update update-database.js
This commit is contained in:
parent
e93d677927
commit
712650e65c
|
@ -15,6 +15,7 @@ const EPG_CODES_FILEPATH = process.env.EPG_CODES_FILEPATH || 'scripts/data/codes
|
||||||
async function main() {
|
async function main() {
|
||||||
await setUp()
|
await setUp()
|
||||||
await loadDatabase()
|
await loadDatabase()
|
||||||
|
await removeDuplicates()
|
||||||
await loadCheckResults()
|
await loadCheckResults()
|
||||||
await findStreamOrigins()
|
await findStreamOrigins()
|
||||||
await updateStreams()
|
await updateStreams()
|
||||||
|
@ -31,6 +32,16 @@ async function loadDatabase() {
|
||||||
logger.info(`Found ${streams.length} streams`)
|
logger.info(`Found ${streams.length} streams`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function removeDuplicates() {
|
||||||
|
logger.info('Removing duplicates...')
|
||||||
|
|
||||||
|
const before = streams.length
|
||||||
|
streams = _.uniqBy(streams, 'id')
|
||||||
|
const after = streams.length
|
||||||
|
|
||||||
|
logger.info(`Removed ${before - after} links`)
|
||||||
|
}
|
||||||
|
|
||||||
async function loadCheckResults() {
|
async function loadCheckResults() {
|
||||||
logger.info('Loading check results from logs/...')
|
logger.info('Loading check results from logs/...')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue