mirror of
https://github.com/iptv-org/iptv
synced 2026-11-25 02:24:59 -05:00
Sort internal playlists after stream updates
This commit is contained in:
1 parent
323d86a002
commit
45e2cab1e9
5 files changed
+49
-12
No files matched your search
@@ -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