From 018558b1816219546970da3c0361822ff14eba7c Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Thu, 11 May 2023 22:24:38 +0200 Subject: [PATCH] return zero seeders download links when needed --- addon/moch/moch.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addon/moch/moch.js b/addon/moch/moch.js index 6cb6066..cba49fa 100644 --- a/addon/moch/moch.js +++ b/addon/moch/moch.js @@ -175,10 +175,11 @@ function populateCachedLinks(streams, mochResult) { function populateDownloadLinks(streams, mochResults) { const torrentStreams = streams.filter(stream => stream.infoHash); + const seededStreams = streams.filter(stream => !stream.title.includes('👤 0')); torrentStreams.forEach(stream => mochResults.forEach(mochResult => { const cachedEntry = mochResult.mochStreams[stream.infoHash]; const isCached = cachedEntry && cachedEntry.cached; - if (!isCached && isHealthyStreamForDebrid(torrentStreams, stream)) { + if (!isCached && isHealthyStreamForDebrid(seededStreams, stream)) { streams.push({ name: `[${mochResult.moch.shortName} download] ${stream.name}`, title: stream.title, @@ -191,8 +192,8 @@ function populateDownloadLinks(streams, mochResults) { } function isHealthyStreamForDebrid(streams, stream) { - const isZeroSeeders = /👤 0\b/.test(stream.title); - const is4kStream = /\b4k\b/.test(stream.name); + const isZeroSeeders = stream.title.includes('👤 0'); + const is4kStream = stream.name.includes('4k'); const isNotEnoughOptions = streams.length <= 5; return !isZeroSeeders || is4kStream || isNotEnoughOptions; }