From 42e498009ce74e94809ec95f9652f2ce17caf5ab Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Mon, 18 Apr 2022 18:33:27 +0300 Subject: [PATCH] improve season/episode validation --- src/withStreamingServer/convertStream.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/withStreamingServer/convertStream.js b/src/withStreamingServer/convertStream.js index c6a3bd3..ef214d9 100644 --- a/src/withStreamingServer/convertStream.js +++ b/src/withStreamingServer/convertStream.js @@ -4,13 +4,16 @@ var createTorrent = require('./createTorrent'); function convertStream(streamingServerURL, stream, seriesInfo) { return new Promise(function(resolve, reject) { - var guessFileIdx = false; if (stream.fileIdx === null || !isFinite(stream.fileIdx)) { guessFileIdx = {}; - if (seriesInfo && (seriesInfo.season || seriesInfo.episode)) { - guessFileIdx.season = seriesInfo.season; - guessFileIdx.episode = seriesInfo.episode; + if (seriesInfo) { + if (seriesInfo.season !== null && isFinite(seriesInfo.season)) { + guessFileIdx.season = seriesInfo.season; + } + if (seriesInfo.episode !== null && isFinite(seriesInfo.episode)) { + guessFileIdx.episode = seriesInfo.episode; + } } }