From 0739182d6d49d83e7cd73e85f053aff3bc2eae3d Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 17 Sep 2023 04:30:37 +0300 Subject: [PATCH] Update generate.ts --- scripts/commands/playlist/generate.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/commands/playlist/generate.ts b/scripts/commands/playlist/generate.ts index bb5169159..44a75be23 100644 --- a/scripts/commands/playlist/generate.ts +++ b/scripts/commands/playlist/generate.ts @@ -36,8 +36,10 @@ async function main() { const subdivisions = new Collection(subdivisionsContent).map(data => new Subdivision(data)) logger.info('loading streams...') - const streams = await loadStreams({ channels, categories, languages }) - logger.info(`found ${streams.count()} streams`) + let streams = await loadStreams({ channels, categories, languages }) + let totalStreams = streams.count() + streams = streams.uniqBy((stream: Stream) => stream.channel || _.uniqueId()) + logger.info(`found ${totalStreams} streams (including ${streams.count()} unique)`) const generatorsLogger = new Logger({ stream: await new Storage(LOGS_DIR).createStream(`generators.log`) @@ -104,7 +106,6 @@ async function loadStreams({ streams = streams .orderBy([(stream: Stream) => stream.channel, (stream: Stream) => stream.url], ['asc', 'asc']) - .uniqBy((stream: Stream) => stream.channel || _.uniqueId()) .map((stream: Stream) => { const channel: Channel | undefined = groupedChannels.get(stream.channel)