Special Episode parsing support in ParsingService

Added ParsingService.ParseSpecialEpisodeTitle
Added SeriesService.FindByNameInexact
Added EpisodeService.FindSpecialEpisodeByName
Added IsPossibleSpecialEpisode method to parse info
DownloadDecisionMaker will try to find special episodes if a parse fails or is a possible special episode
This commit is contained in:
Icer Addis
2014-01-07 00:24:50 -08:00
parent d727840fbf
commit 6ee08af111
6 changed files with 165 additions and 0 deletions
+14
View File
@@ -114,6 +114,11 @@ namespace NzbDrone.Core.Parser
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_)?(?<year>\d{4})",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex NonWordRegex = new Regex(@"\W+", RegexOptions.Compiled);
private static readonly Regex CommonWordRegex = new Regex(@"\b(a|an|the|and|or|of|part)\b\s?",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static ParsedEpisodeInfo ParsePath(string path)
{
var fileInfo = new FileInfo(path);
@@ -220,6 +225,15 @@ namespace NzbDrone.Core.Parser
return MultiPartCleanupRegex.Replace(title, string.Empty).Trim();
}
public static string NormalizeEpisodeTitle(string title)
{
// convert any non-word characters to a single space
string normalizedSpaces = NonWordRegex.Replace(title, " ").ToLower();
// remove common words
string normalized = CommonWordRegex.Replace(normalizedSpaces, String.Empty);
return normalized;
}
public static string ParseReleaseGroup(string title)
{
const string defaultReleaseGroup = "DRONE";