[scraper] improve episode detection when not parsed

This commit is contained in:
TheBeastLT
2021-03-02 08:57:52 +01:00
parent f5974beeaf
commit c201a741ef
4 changed files with 9 additions and 3 deletions

View File

@@ -47,6 +47,11 @@ function parseSeriesVideo(video, parsedTorrentName) {
videoInfo.episodes = epMatcher && [parseInt(epMatcher[1], 10)];
videoInfo.episode = videoInfo.episodes && videoInfo.episodes[0];
}
if (!videoInfo.episodes && !videoInfo.date) {
const epMatcher = video.name.match(new RegExp(`(?:\\(${videoInfo.year}\\)|part)[._ ]?(\\d{1,3})(?:\\b|_)`, "i"));
videoInfo.episodes = epMatcher && [parseInt(epMatcher[1], 10)];
videoInfo.episode = videoInfo.episodes && videoInfo.episodes[0];
}
return { ...video, ...videoInfo };
}