mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 10:00:05 -04:00
Sort similar links by status
This commit is contained in:
parent
63ce588aca
commit
e8923a15de
3 changed files with 16 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue