From 7193b8a75ba9531fd8a9d2c5cf2ef04c109a090c Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 24 Feb 2021 11:48:22 +0100 Subject: [PATCH] [scraper] parse russian season if present --- scraper/lib/parseHelper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scraper/lib/parseHelper.js b/scraper/lib/parseHelper.js index 38aca4f..cf3789a 100644 --- a/scraper/lib/parseHelper.js +++ b/scraper/lib/parseHelper.js @@ -26,6 +26,11 @@ function parseSeriesVideo(video, parsedTorrentName) { // in case single file was interpreted as having multiple seasons videoInfo.season = videoInfo.seasons[0]; } + if (!hasSeason && video.path.includes('/') && parsedTorrentName.seasons && parsedTorrentName.seasons.length > 1) { + // russian season are usually named with 'series name-2` i.e. Улицы разбитых фонарей-6/22. Одиночный выстрел.mkv + const folderPathSeasonMatch = video.path.match(/[\u0400-\u04ff]-(\d{1,2})(?=.*\/)/); + videoInfo.season = folderPathSeasonMatch && parseInt(folderPathSeasonMatch[1], 10) || undefined; + } // sometimes video file does not have correct date format as in torrent title if (!videoInfo.episodes && !videoInfo.date && parsedTorrentName.date) { videoInfo.date = parsedTorrentName.date; @@ -79,7 +84,7 @@ function isPackTorrent(torrent) { return parsedInfo.complete || typeof parsedInfo.year === 'string' || /movies/i.test(torrent.title); } const hasMultipleEpisodes = parsedInfo.complete || torrent.size > MULTIPLE_FILES_SIZE || - (parsedInfo.seasons && parsedInfo.seasons.length > 1); + (parsedInfo.seasons && parsedInfo.seasons.length > 0); const hasSingleEpisode = Number.isInteger(parsedInfo.episode) || (!parsedInfo.episodes && parsedInfo.date); return hasMultipleEpisodes && !hasSingleEpisode; }