Update generate.js

pull/6702/head^2
Aleksandr Statciuk 3 years ago
parent a9e58e0ee3
commit a4aa6e7d1e

@ -33,7 +33,12 @@ async function loadStreams() {
await db.streams.load()
let streams = await db.streams.find({})
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())
await api.channels.load()

Loading…
Cancel
Save