1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

Fixed: Parsing of poorly named anime above 1000 episodes

Closes #4755
This commit is contained in:
Mark McDowall 2021-11-23 16:36:48 -08:00
parent f26540cdc7
commit 73429a0823
3 changed files with 7 additions and 5 deletions

View File

@ -107,6 +107,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("[Chihiro] Anime Title 300-nen, With Even More Title 02 [720p Hi10P AAC][031FA533]", "Anime Title 300-nen, With Even More Title", 2, 0, 0)]
[TestCase("[BakeSubs] 86 - 01 [1080p][D40A9E55].mkv", "86", 1, 0, 0)]
[TestCase("Anime Title the Final - 09 (2021) [SubsPlease] [WEBRip] [HD 1080p]", "Anime Title the Final", 9, 0, 0)]
[TestCase("Anime Title S21 999", "Anime Title S21", 999, 0, 0)]
[TestCase("Anime Title S21 1000", "Anime Title S21", 1000, 0, 0)]
//[TestCase("", "", 0, 0, 0)]
public void should_parse_absolute_numbers(string postTitle, string title, int absoluteEpisodeNumber, int seasonNumber, int episodeNumber)
{

View File

@ -18,8 +18,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase(@"P:\TV Shows\Series\Season 6\S06E13 - 5 to 9 - 720p BluRay.mkv", 6, 13)]
[TestCase(@"S:\TV Drop\Series - 10x11 - Title [SDTV]\1011 - Title.avi", 10, 11)]
[TestCase(@"/TV Drop/Series - 10x11 - Title [SDTV]/1011 - Title.avi", 10, 11)]
[TestCase(@"S:\TV Drop\Series Title - 10x12 - 24 Hours of Development [SDTV]\1012 - 24 Hours of Development.avi", 10, 12)]
[TestCase(@"/TV Drop/Series Title - 10x12 - 24 Hours of Development [SDTV]/1012 - 24 Hours of Development.avi", 10, 12)]
[TestCase(@"S:\TV Drop\Series Title - 10x12 - 24 Hours of Development [SDTV]\1012 - Hours of Development.avi", 10, 12)]
[TestCase(@"/TV Drop/Series Title - 10x12 - 24 Hours of Development [SDTV]/1012 - Hours of Development.avi", 10, 12)]
[TestCase(@"S:\TV Drop\Series Title - 10x12 - 24 Hours of Development [SDTV]\Hours of Development.avi", 10, 12)]
[TestCase(@"/TV Drop/Series Title - 10x12 - 24 Hours of Development [SDTV]/Hours of Development.avi", 10, 12)]
[TestCase(@"E:\Downloads\tv\Series.Title.S01E01.720p.HDTV\ajifajjjeaeaeqwer_eppj.avi", 1, 1)]

View File

@ -286,7 +286,7 @@ namespace NzbDrone.Core.Parser
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Supports 1103/1113 naming
new Regex(@"^(?<title>.+?)?(?:(?:[-_. ](?<![()\[!]))*(?<season>(?<!\d+|\(|\[|e|x)\d{2})(?<episode>(?<!e|x)\d{2}(?!p|i|\d+|\)|\]|\W\d+|\W(?:e|ep|x)\d+)))+([-_. ]+|$)(?!\\)",
new Regex(@"^(?<title>.+?)?(?:(?:[-_.](?<![()\[!]))*(?<season>(?<!\d+|\(|\[|e|x)\d{2})(?<episode>(?<!e|x)(?:[1-9][0-9]|[0][1-9])(?!p|i|\d+|\)|\]|\W\d+|\W(?:e|ep|x)\d+)))+([-_.]+|$)(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes with single digit episode number (S01E1, S01E5E6, etc)
@ -318,7 +318,7 @@ namespace NzbDrone.Core.Parser
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Anime - Title Absolute Episode Number
new Regex(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)?(?<title>.+?)(?:[-_. ]+(?<absoluteepisode>(?<!\d+)\d{2,3}(\.\d{1,2})?(?!\d+|[ip])))+(?:_|-|\s|\.)*?(?<hash>\[.{8}\])?(?:$|\.)?",
new Regex(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)?(?<title>.+?)(?:[-_. ]+(?<absoluteepisode>(?<!\d+)\d{2,4}(\.\d{1,2})?(?!\d+|[ip])))+(?:_|-|\s|\.)*?(?<hash>\[.{8}\])?(?:$|\.)?",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Anime - Title {Absolute Episode Number}
@ -327,7 +327,7 @@ namespace NzbDrone.Core.Parser
//Extant, terrible multi-episode naming (extant.10708.hdtv-lol.mp4)
new Regex(@"^(?<title>.+?)[-_. ](?<season>[0]?\d?)(?:(?<episode>\d{2}){2}(?!\d+))[-_. ]",
RegexOptions.IgnoreCase | RegexOptions.Compiled)
RegexOptions.IgnoreCase | RegexOptions.Compiled),
};