From 25f2cd8a3250844afc613ed51ee983ce93809a67 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sat, 23 Aug 2025 19:48:58 +0300 Subject: [PATCH] Update scripts --- scripts/generators/countriesGenerator.ts | 12 ++++++++++++ scripts/generators/indexCountryGenerator.ts | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/generators/countriesGenerator.ts b/scripts/generators/countriesGenerator.ts index 2cd5cab760..4cd539deaf 100644 --- a/scripts/generators/countriesGenerator.ts +++ b/scripts/generators/countriesGenerator.ts @@ -40,5 +40,17 @@ export class CountriesGenerator implements Generator { JSON.stringify({ type: 'country', filepath, count: playlist.streams.count() }) + EOL ) }) + + const undefinedStreams = streams.filter((stream: Stream) => !stream.hasBroadcastArea()) + const undefinedPlaylist = new Playlist(undefinedStreams, { public: true }) + const undefinedFilepath = 'countries/undefined.m3u' + await this.storage.save(undefinedFilepath, undefinedPlaylist.toString()) + this.logFile.append( + JSON.stringify({ + type: 'country', + filepath: undefinedFilepath, + count: undefinedPlaylist.streams.count() + }) + EOL + ) } } diff --git a/scripts/generators/indexCountryGenerator.ts b/scripts/generators/indexCountryGenerator.ts index c7e5e2f848..7384dd8836 100644 --- a/scripts/generators/indexCountryGenerator.ts +++ b/scripts/generators/indexCountryGenerator.ts @@ -26,7 +26,12 @@ export class IndexCountryGenerator implements Generator { .orderBy((stream: Stream) => stream.getTitle()) .filter((stream: Stream) => stream.isSFW()) .forEach((stream: Stream) => { - if (!stream.hasBroadcastArea()) return + if (!stream.hasBroadcastArea()) { + const streamClone = stream.clone() + streamClone.groupTitle = 'Undefined' + groupedStreams.add(streamClone) + return + } stream.getBroadcastCountries().forEach((country: Country) => { const streamClone = stream.clone() @@ -35,7 +40,11 @@ export class IndexCountryGenerator implements Generator { }) }) - groupedStreams = groupedStreams.orderBy((stream: Stream) => stream.groupTitle) + groupedStreams = groupedStreams.orderBy((stream: Stream) => { + if (stream.groupTitle === 'Undefined') return 'ZZZ' + + return stream.groupTitle + }) const playlist = new Playlist(groupedStreams, { public: true }) const filepath = 'index.country.m3u'