Sort similar links by status
This commit is contained in:
@ -6,7 +6,12 @@ const _ = require('lodash')
|
||||
async function main() {
|
||||
await db.streams.load()
|
||||
let streams = await db.streams.find({})
|
||||
streams = orderBy(streams, ['title', 'height', 'url'], ['asc', 'desc', 'asc'])
|
||||
const levels = { online: 1, blocked: 2, timeout: 3, error: 4, default: 5 }
|
||||
streams = orderBy(
|
||||
streams,
|
||||
['title', s => levels[s.status] || levels['default'], 'height', 'url'],
|
||||
['asc', 'asc', 'desc', 'asc']
|
||||
)
|
||||
|
||||
const files = _.groupBy(streams, 'filepath')
|
||||
for (const filepath in files) {
|
||||
|
Reference in New Issue
Block a user