Fixed: Incorrect parsing of filenames with [SDTV] suffix trigging Anime pattern.
This commit is contained in:
parent
0688340722
commit
bb52f3d41c
|
@ -129,6 +129,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
[TestCase("Jeopardy - 2016x231", "Jeopardy", 2016, 231)]
|
[TestCase("Jeopardy - 2016x231", "Jeopardy", 2016, 231)]
|
||||||
[TestCase("Shortland.Street.S26E022.HDTV.x264-FiHTV", "Shortland Street", 26, 22)]
|
[TestCase("Shortland.Street.S26E022.HDTV.x264-FiHTV", "Shortland Street", 26, 22)]
|
||||||
[TestCase("Super.Potatoes.S01.Ep06.1080p.BluRay.DTS.x264-MiR", "Super Potatoes", 1, 6)]
|
[TestCase("Super.Potatoes.S01.Ep06.1080p.BluRay.DTS.x264-MiR", "Super Potatoes", 1, 6)]
|
||||||
|
[TestCase("Room 104 - S01E07 The Missionaries [SDTV]", "Room 104", 1, 7)]
|
||||||
//[TestCase("", "", 0, 0)]
|
//[TestCase("", "", 0, 0)]
|
||||||
public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber)
|
public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
|
|
|
@ -262,6 +262,9 @@ namespace NzbDrone.Core.Parser
|
||||||
private static readonly Regex CleanTorrentSuffixRegex = new Regex(@"\[(?:ettv|rartv|rarbg|cttv)\]$",
|
private static readonly Regex CleanTorrentSuffixRegex = new Regex(@"\[(?:ettv|rartv|rarbg|cttv)\]$",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
private static readonly Regex CleanQualityBracketsRegex = new Regex(@"\[[a-z0-9 ._-]+\]$",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+)(?<!WEB-DL|480p|720p|1080p|2160p)(?:\b|[-._ ])",
|
private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+)(?<!WEB-DL|480p|720p|1080p|2160p)(?:\b|[-._ ])",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
@ -329,6 +332,16 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle, string.Empty);
|
simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle, string.Empty);
|
||||||
|
|
||||||
|
simpleTitle = CleanQualityBracketsRegex.Replace(simpleTitle, m =>
|
||||||
|
{
|
||||||
|
if (QualityParser.ParseQualityName(m.Value).Quality != Qualities.Quality.Unknown)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.Value;
|
||||||
|
});
|
||||||
|
|
||||||
var airDateMatch = AirDateRegex.Match(simpleTitle);
|
var airDateMatch = AirDateRegex.Match(simpleTitle);
|
||||||
if (airDateMatch.Success)
|
if (airDateMatch.Success)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,29 @@ namespace NzbDrone.Core.Parser
|
||||||
Logger.Debug("Trying to parse quality for {0}", name);
|
Logger.Debug("Trying to parse quality for {0}", name);
|
||||||
|
|
||||||
name = name.Trim();
|
name = name.Trim();
|
||||||
|
|
||||||
|
var result = ParseQualityName(name);
|
||||||
|
|
||||||
|
//Based on extension
|
||||||
|
if (result.Quality == Quality.Unknown && !name.ContainsInvalidPathChars())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result.Quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name));
|
||||||
|
result.QualitySource = QualitySource.Extension;
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
//Swallow exception for cases where string contains illegal
|
||||||
|
//path characters.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static QualityModel ParseQualityName(string name)
|
||||||
|
{
|
||||||
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
|
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
|
||||||
var result = ParseQualityModifiers(name, normalizedName);
|
var result = ParseQualityModifiers(name, normalizedName);
|
||||||
|
|
||||||
|
@ -298,21 +321,6 @@ namespace NzbDrone.Core.Parser
|
||||||
result.Quality = otherSourceMatch;
|
result.Quality = otherSourceMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Based on extension
|
|
||||||
if (result.Quality == Quality.Unknown && !name.ContainsInvalidPathChars())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result.Quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name));
|
|
||||||
result.QualitySource = QualitySource.Extension;
|
|
||||||
}
|
|
||||||
catch (ArgumentException)
|
|
||||||
{
|
|
||||||
//Swallow exception for cases where string contains illegal
|
|
||||||
//path characters.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue