Fixed: Parsing of single episode numbers

Closes #5022
This commit is contained in:
Mark McDowall 2022-05-15 14:47:23 -07:00
parent c00cbb9a5a
commit a81a80a00f
2 changed files with 6 additions and 0 deletions

View File

@ -149,6 +149,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Anime Title - S2010E994 [0994] [2010-02-28] - Episode Title [x264 720p][AAC 2ch][HS][Shion+GakiDave]", "Anime Title", 2010, 994)]
[TestCase("Series Title - Temporada 2 [HDTV 720p][Cap.201][AC3 5.1 Castellano][www.pctnew.com]", "Series Title", 2, 1)]
[TestCase("Series Title - Temporada 2 [HDTV 720p][Cap.1901][AC3 5.1 Castellano][www.pctnew.com]", "Series Title", 19, 1)]
[TestCase("Series Title 1x1", "Series Title", 1, 1)]
[TestCase("1x1", "", 1, 1)]
//[TestCase("", "", 0, 0)]
public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber)
{

View File

@ -351,6 +351,10 @@ namespace NzbDrone.Core.Parser
//Season only releases for poorly named anime
new Regex(@"^(?:\[(?<subgroup>.+?)\][-_. ])?(?<title>.+?)[-_. ]+?[\[(](?:S|Season|Saison|Series)[-_. ]?(?<season>\d{1,2}(?![-_. ]?\d+))(?:[-_. )\]]|$)+(?<extras>EXTRAS|SUBPACK)?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes without a title, Single episode numbers (S1E1, 1x1)
new Regex(@"^(?:S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[-_ ]?[ex])(?<episode>\d{1}(?!\d+))))",
RegexOptions.IgnoreCase | RegexOptions.Compiled)
};