mirror of https://github.com/lidarr/Lidarr
Parser REGEX updated to support 103 naming and breaking out of the REGEX foreach loop when a match is found. Most strict to less strict ordering of REGEX is required.
This commit is contained in:
parent
302949048b
commit
f1db8f52bf
|
@ -18,7 +18,8 @@ namespace NzbDrone.Core
|
||||||
|
|
||||||
private static readonly Regex[] ReportTitleRegex = new[]
|
private static readonly Regex[] ReportTitleRegex = new[]
|
||||||
{
|
{
|
||||||
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled)
|
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)\W(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports 103 naming
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex NormalizeRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex NormalizeRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
@ -65,6 +66,7 @@ namespace NzbDrone.Core
|
||||||
|
|
||||||
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
||||||
}
|
}
|
||||||
|
break; //Break out of the for loop, we don't want to process every REGEX for each item otherwise we'll get duplicates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue