mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user