Fixed language parsing of movies with language in movie name.

Fixes #793
Leonardo Galli 8 years ago
parent 89e5001bad
commit a0050fedd3

@ -46,10 +46,16 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUNDUB-LOL", Language.Hungarian)]
[TestCase("Castle.2009.S01E14.HDTV.XviD.ENG.HUN-LOL", Language.Hungarian)]
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUN-LOL", Language.Hungarian)]
[TestCase("The Danish Girl 2015", Language.English)]
public void should_parse_language(string postTitle, Language language)
{
var result = LanguageParser.ParseLanguage(postTitle);
result.Should().Be(language);
var result = Parser.Parser.ParseMovieTitle(postTitle);
if (result == null)
{
Parser.Parser.ParseTitle(postTitle).Language.Should().Be(language);
return;
}
result.Language.Should().Be(language);
}
[TestCase("2 Broke Girls - S01E01 - Pilot.en.sub", Language.English)]

@ -81,5 +81,11 @@ namespace NzbDrone.Core.Test.ParserTests
{
Parser.Parser.ParseMovieTitle(postTitle).Year.Should().Be(year);
}
[TestCase("The Danish Girl 2015")]
public void should_not_parse_language_in_movie_title(string postTitle)
{
Parser.Parser.ParseMovieTitle(postTitle).Language.Should().Be(Language.English);
}
}
}

@ -406,7 +406,7 @@ namespace NzbDrone.Core.Parser
if (result != null)
{
result.Language = LanguageParser.ParseLanguage(title);
result.Language = LanguageParser.ParseLanguage(simpleTitle.Replace(result.MovieTitle, "A Movie"));
Logger.Debug("Language parsed: {0}", result.Language);
result.Quality = QualityParser.ParseQuality(title);

Loading…
Cancel
Save