mirror of
https://github.com/iptv-org/iptv.git
synced 2026-11-24 01:01:01 +02:00
Sort internal playlists after stream updates
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { Collection } from '@freearhey/core'
|
||||
import { Stream } from '../models'
|
||||
|
||||
// Keep internal playlists in the same order as playlist:format without
|
||||
// performing its URL normalization, deduplication or network probing.
|
||||
export function sortStreams(streams: Collection<Stream>): Collection<Stream> {
|
||||
return streams.sortBy(
|
||||
[
|
||||
(stream: Stream) => stream.title,
|
||||
(stream: Stream) => (stream.isGeoBlocked ? -1 : 0),
|
||||
(stream: Stream) => (stream.isNot247 ? -1 : 0),
|
||||
(stream: Stream) => stream.getVerticalResolution(),
|
||||
(stream: Stream) => stream.url
|
||||
],
|
||||
['asc', 'desc', 'desc', 'desc', 'asc']
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user