From a297f33aef66468f6b79f8af1a74f19e14965dcc Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 6 Jan 2021 21:25:02 +0100 Subject: [PATCH] [scraper] handle zero season in parser --- scraper/lib/parseHelper.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scraper/lib/parseHelper.js b/scraper/lib/parseHelper.js index 2134309..80a8323 100644 --- a/scraper/lib/parseHelper.js +++ b/scraper/lib/parseHelper.js @@ -10,16 +10,17 @@ function parseSeriesVideos(torrent, videos) { function parseSeriesVideo(video, parsedTorrentName) { const videoInfo = parse(video.name); + const hasSeason = Number.isInteger(videoInfo.season); // the episode may be in a folder containing season number - if (!videoInfo.season && video.path.includes('/')) { + if (!hasSeason && video.path.includes('/')) { const folders = video.path.split('/'); const pathInfo = parse(folders[folders.length - 2]); videoInfo.season = pathInfo.season; } - if (!videoInfo.season && parsedTorrentName.season) { + if (!hasSeason && parsedTorrentName.season) { videoInfo.season = parsedTorrentName.season; } - if (!videoInfo.season && videoInfo.seasons && videoInfo.seasons.length > 1) { + if (!hasSeason && videoInfo.seasons && videoInfo.seasons.length > 1) { // in case single file was interpreted as having multiple seasons videoInfo.season = videoInfo.seasons[0]; }