Fixed: Prevent misinterpreting Season folder as anime release title

This commit is contained in:
Taloth Saldono 2020-08-10 23:57:54 +02:00
parent f3101a1db2
commit e6175581bd
2 changed files with 18 additions and 0 deletions

View File

@ -92,5 +92,12 @@ namespace NzbDrone.Core.Test.ParserTests
result.IsPartialSeason.Should().BeFalse(); result.IsPartialSeason.Should().BeFalse();
result.IsMultiSeason.Should().BeTrue(); result.IsMultiSeason.Should().BeTrue();
} }
[Test]
public void should_not_parse_season_folders()
{
var result = Parser.Parser.ParseTitle("Season 3");
result.Should().BeNull();
}
} }
} }

View File

@ -341,6 +341,11 @@ namespace NzbDrone.Core.Parser
new Regex(@"^\d{6}_\d{2}$"), new Regex(@"^\d{6}_\d{2}$"),
}; };
private static readonly Regex[] SeasonFolderRegexes = new Regex[]
{
new Regex(@"^(Season[ ._-]*\d+|Specials)$", RegexOptions.Compiled)
};
//Regex to detect whether the title was reversed. //Regex to detect whether the title was reversed.
private static readonly Regex ReversedTitleRegex = new Regex(@"(?:^|[-._ ])(p027|p0801|\d{2,3}E\d{2}S)[-._ ]", RegexOptions.Compiled); private static readonly Regex ReversedTitleRegex = new Regex(@"(?:^|[-._ ])(p027|p0801|\d{2,3}E\d{2}S)[-._ ]", RegexOptions.Compiled);
@ -917,6 +922,12 @@ namespace NzbDrone.Core.Parser
return false; return false;
} }
if (SeasonFolderRegexes.Any(v => v.IsMatch(titleWithoutExtension)))
{
Logger.Debug("Rejected Season Folder Release Title: " + title);
return false;
}
return true; return true;
} }