|
|
@ -1,5 +1,5 @@
|
|
|
|
const { create: createPlaylist } = require('../../core/playlist')
|
|
|
|
const { create: createPlaylist } = require('../../core/playlist')
|
|
|
|
const { db, api, logger, file } = require('../../core')
|
|
|
|
const { db, logger, file } = require('../../core')
|
|
|
|
const { orderBy } = require('natural-orderby')
|
|
|
|
const { orderBy } = require('natural-orderby')
|
|
|
|
const _ = require('lodash')
|
|
|
|
const _ = require('lodash')
|
|
|
|
|
|
|
|
|
|
|
@ -8,21 +8,6 @@ async function main() {
|
|
|
|
await db.streams.load()
|
|
|
|
await db.streams.load()
|
|
|
|
let streams = await db.streams.find({})
|
|
|
|
let streams = await db.streams.find({})
|
|
|
|
|
|
|
|
|
|
|
|
logger.info(`loading channels...`)
|
|
|
|
|
|
|
|
await api.channels.load()
|
|
|
|
|
|
|
|
const channels = _.keyBy(await api.channels.all(), 'id')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('removing invalid tvg-id...')
|
|
|
|
|
|
|
|
streams = streams.map(stream => {
|
|
|
|
|
|
|
|
const channel = channels[stream.channel]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!channel) {
|
|
|
|
|
|
|
|
stream.channel = null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return stream
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('sorting links...')
|
|
|
|
logger.info('sorting links...')
|
|
|
|
streams = orderBy(
|
|
|
|
streams = orderBy(
|
|
|
|
streams,
|
|
|
|
streams,
|
|
|
|