Skip to content

Commit

Permalink
improve season/episode validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nklhtv committed Apr 18, 2022
1 parent 503e8a1 commit 42e4980
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/withStreamingServer/convertStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 42e4980

Please sign in to comment.