1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-24 08:42:19 +02:00

New: Treat batch releases with total episode count as full season release

Closes #6757
This commit is contained in:
Mark McDowall 2024-05-03 16:09:56 -07:00
parent c81ae65461
commit aee686ede8
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -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(@"^((?<title>.*?)[ ._]\/[ ._])+\(?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>();