mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-25 22:46:31 -04:00
@@ -385,6 +385,9 @@ namespace NzbDrone.Core.Parser
|
||||
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_)?(?<year>\d{4})",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex TitleComponentsRegex = new Regex(@"^(?<title>.+?) \((?<title>.+?)\)$",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex WordDelimiterRegex = new Regex(@"(\s|\.|,|_|-|=|\|)+", RegexOptions.Compiled);
|
||||
private static readonly Regex PunctuationRegex = new Regex(@"[^\w\s]", RegexOptions.Compiled);
|
||||
private static readonly Regex CommonWordRegex = new Regex(@"\b(a|an|the|and|or|of)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
@@ -670,13 +673,19 @@ namespace NzbDrone.Core.Parser
|
||||
{
|
||||
seriesTitleInfo.TitleWithoutYear = title;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
seriesTitleInfo.TitleWithoutYear = match.Groups["title"].Value;
|
||||
seriesTitleInfo.Year = Convert.ToInt32(match.Groups["year"].Value);
|
||||
}
|
||||
|
||||
var matchComponents = TitleComponentsRegex.Match(seriesTitleInfo.TitleWithoutYear);
|
||||
|
||||
if (matchComponents.Success)
|
||||
{
|
||||
seriesTitleInfo.AllTitles = matchComponents.Groups["title"].Captures.OfType<Capture>().Select(v => v.Value).ToArray();
|
||||
}
|
||||
|
||||
return seriesTitleInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user