mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 18:10:04 -04:00
Update generate.js
This commit is contained in:
parent
a9e58e0ee3
commit
a4aa6e7d1e
1 changed files with 6 additions and 1 deletions
|
@ -33,7 +33,12 @@ async function loadStreams() {
|
||||||
await db.streams.load()
|
await db.streams.load()
|
||||||
let streams = await db.streams.find({})
|
let streams = await db.streams.find({})
|
||||||
streams = _.filter(streams, stream => stream.status !== 'error')
|
streams = _.filter(streams, stream => stream.status !== 'error')
|
||||||
streams = orderBy(streams, ['channel', 'height', 'url'], ['asc', 'desc', 'asc'])
|
const levels = { online: 1, blocked: 2, timeout: 3, error: 4, default: 5 }
|
||||||
|
streams = orderBy(
|
||||||
|
streams,
|
||||||
|
['channel', s => levels[s.status] || levels['default'], 'height', 'url'],
|
||||||
|
['asc', 'asc', 'desc', 'asc']
|
||||||
|
)
|
||||||
streams = _.uniqBy(streams, stream => stream.channel || _.uniqueId())
|
streams = _.uniqBy(streams, stream => stream.channel || _.uniqueId())
|
||||||
|
|
||||||
await api.channels.load()
|
await api.channels.load()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue