Update scripts

This commit is contained in:
freearhey 2025-03-30 03:01:05 +03:00
parent e0b0de6b2b
commit f32a3f9e77
5 changed files with 64 additions and 23 deletions

View file

@ -57,7 +57,7 @@ async function main() {
streams = streams.orderBy(
[
(stream: Stream) => stream.name,
(stream: Stream) => stream.getHorizontalResolution(),
(stream: Stream) => stream.getVerticalResolution(),
(stream: Stream) => stream.getLabel(),
(stream: Stream) => stream.url
],

View file

@ -89,7 +89,7 @@ async function main() {
regionsGroupedByCode,
subdivisionsGroupedByCode
)
.withBroadcastRegions(regions, regionsGroupedByCode)
.withBroadcastRegions(regions)
.withBroadcastSubdivisions(subdivisionsGroupedByCode)
)
const feedsGroupedByChannelId = feeds.groupBy((feed: Feed) =>
@ -106,14 +106,16 @@ async function main() {
const files = await storage.list('**/*.m3u')
let streams = await parser.parse(files)
const totalStreams = streams.count()
streams = streams.uniqBy((stream: Stream) => stream.getId() || uniqueId())
streams = streams.uniqBy((stream: Stream) =>
stream.hasId() ? stream.getChannelId() + stream.getFeedId() : uniqueId()
)
logger.info(`found ${totalStreams} streams (including ${streams.count()} unique)`)
logger.info('sorting streams...')
streams = streams.orderBy(
[
(stream: Stream) => stream.getId(),
(stream: Stream) => stream.getHorizontalResolution(),
(stream: Stream) => stream.getVerticalResolution(),
(stream: Stream) => stream.getLabel()
],
['asc', 'asc', 'desc']