From 593db47ea315622c2ac89465c31e422ff293a7d5 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Mon, 31 Mar 2025 07:50:35 +0300 Subject: [PATCH] Update scripts --- scripts/generators/indexRegionGenerator.ts | 12 ++++++++++-- scripts/models/feed.ts | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/generators/indexRegionGenerator.ts b/scripts/generators/indexRegionGenerator.ts index 1e31d4416..94537c9af 100644 --- a/scripts/generators/indexRegionGenerator.ts +++ b/scripts/generators/indexRegionGenerator.ts @@ -26,8 +26,15 @@ export class IndexRegionGenerator implements Generator { let groupedStreams = new Collection() this.streams .orderBy((stream: Stream) => stream.getTitle()) - .filter((stream: Stream) => stream.isSFW() && !stream.isInternational()) + .filter((stream: Stream) => stream.isSFW()) .forEach((stream: Stream) => { + if (stream.isInternational()) { + const streamClone = stream.clone() + streamClone.groupTitle = 'International' + groupedStreams.push(streamClone) + return + } + if (!stream.hasBroadcastArea()) { const streamClone = stream.clone() streamClone.groupTitle = 'Undefined' @@ -43,7 +50,8 @@ export class IndexRegionGenerator implements Generator { }) groupedStreams = groupedStreams.orderBy((stream: Stream) => { - if (stream.groupTitle === 'Undefined') return 'ZZ' + if (stream.groupTitle === 'International') return 'ZZ' + if (stream.groupTitle === 'Undefined') return 'ZZZ' return stream.groupTitle }) diff --git a/scripts/models/feed.ts b/scripts/models/feed.ts index 67d37a254..03e34762b 100644 --- a/scripts/models/feed.ts +++ b/scripts/models/feed.ts @@ -109,12 +109,18 @@ export class Feed { this.broadcastRegionCodes.forEach((code: string) => { const region: Region = regionsGroupedByCode.get(code) - broadcastCountries = broadcastCountries.concat(region.countryCodes) + if (region) { + region.countryCodes.forEach((countryCode: string) => { + broadcastCountries.add(countriesGroupedByCode.get(countryCode)) + }) + } }) this.broadcastSubdivisionCodes.forEach((code: string) => { const subdivision: Subdivision = subdivisionsGroupedByCode.get(code) - broadcastCountries.add(countriesGroupedByCode.get(subdivision.countryCode)) + if (subdivision) { + broadcastCountries.add(countriesGroupedByCode.get(subdivision.countryCode)) + } }) this.broadcastCountries = broadcastCountries.uniq().filter(Boolean)