From e13ab0c70ffe7546c3c2a9764def7bf7b697f706 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Fri, 16 May 2025 15:31:54 +0000 Subject: [PATCH] chore: compare by label if both height and bytes are the same --- src/utils/StreamResolver.test.ts | 8 ++++---- src/utils/StreamResolver.ts | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/utils/StreamResolver.test.ts b/src/utils/StreamResolver.test.ts index 16fcae2..8740f59 100644 --- a/src/utils/StreamResolver.test.ts +++ b/src/utils/StreamResolver.test.ts @@ -66,17 +66,17 @@ describe('resolve', () => { { url: expect.any(String), name: 'WebStreamr 720p', - title: 'SuperVideo | 💾 1.1 GB | 🇮🇹', + title: 'Dropload | 💾 1.1 GB | 🇮🇹', behaviourHints: { - bingeGroup: 'webstreamr-supervideo_it', + bingeGroup: 'webstreamr-dropload_it', }, }, { url: expect.any(String), name: 'WebStreamr 720p', - title: 'Dropload | 💾 1.1 GB | 🇮🇹', + title: 'SuperVideo | 💾 1.1 GB | 🇮🇹', behaviourHints: { - bingeGroup: 'webstreamr-dropload_it', + bingeGroup: 'webstreamr-supervideo_it', }, }, { diff --git a/src/utils/StreamResolver.ts b/src/utils/StreamResolver.ts index 0cb1784..f966552 100644 --- a/src/utils/StreamResolver.ts +++ b/src/utils/StreamResolver.ts @@ -52,7 +52,12 @@ export class StreamResolver { return heightComparison; } - return b.bytes - a.bytes; + const bytesComparison = b.bytes - a.bytes; + if (bytesComparison !== 0) { + return bytesComparison; + } + + return a.label.localeCompare(b.label); }); this.logger.info(`Return ${urlResults.length} streams`);