From aee686ede873865e1f9f7cd17034ea7c511e66f3 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 3 May 2024 16:09:56 -0700 Subject: [PATCH] New: Treat batch releases with total episode count as full season release Closes #6757 --- src/NzbDrone.Core.Test/ParserTests/SeasonParserFixture.cs | 2 ++ src/NzbDrone.Core/Parser/Parser.cs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/SeasonParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SeasonParserFixture.cs index 9910d612f..65b093c33 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SeasonParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SeasonParserFixture.cs @@ -31,6 +31,8 @@ public class SeasonParserFixture : CoreTest [TestCase("Series.Stagione.3.HDTV.XviD-NOTAG", "Series", 3)] [TestCase("Series.Stagione.3.HDTV.XviD-NOTAG", "Series", 3)] [TestCase("Series No More S01 2023 1080p WEB-DL AVC AC3 2.0 Dual Audio -ZR-", "Series No More", 1)] + [TestCase("Series Title / S1E1-8 of 8 [2024, WEB-DL 1080p] + Original + RUS", "Series Title", 1)] + [TestCase("Series Title / S2E1-16 of 16 [2022, WEB-DL] RUS", "Series Title", 2)] public void should_parse_full_season_release(string postTitle, string title, int season) { var result = Parser.Parser.ParseTitle(postTitle); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index e111cfae6..74f2f4a34 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -183,7 +183,7 @@ public static class Parser RegexOptions.IgnoreCase | RegexOptions.Compiled), // Single or multi episode releases with multiple titles, then season and episode numbers after the last title. (Title1 / Title2 / ... / S1E1-2 of 6) - new Regex(@"^((?.*?)[ ._]\/[ ._])+\(?S(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:\W|_)?E?[ ._]?(?<episode>(?<!\d+)\d{1,2}(?!\d+))(?:-(?<episode>(?<!\d+)\d{1,2}(?!\d+)))?([ ._]of[ ._]\d+)?\)?[ ._][\(\[]", + new Regex(@"^((?<title>.*?)[ ._]\/[ ._])+\(?S(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:\W|_)?E?[ ._]?(?<episode>(?<!\d+)\d{1,2}(?!\d+))(?:-(?<episode>(?<!\d+)\d{1,2}(?!\d+)))?(?:[ ._]of[ ._](?<episodecount>\d{1,2}))?\)?[ ._][\(\[]", RegexOptions.IgnoreCase | RegexOptions.Compiled), // Multi-episode with title (S01E99-100, S01E05-06) @@ -1087,6 +1087,12 @@ private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchColle result.FullSeason = true; } } + + if (episodeCaptures.Count == 2 && matchCollection[0].Groups["episodecount"].Success && episodeCaptures.Last().Value == matchCollection[0].Groups["episodecount"].Value) + { + result.EpisodeNumbers = Array.Empty<int>(); + result.FullSeason = true; + } } var seasons = new List<int>();