mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
Fixed: Multi language release being rejected when indexer profile is setup for original and any other language (#6311)
This commit is contained in:
parent
543f2e7ddc
commit
5f229b78be
@ -27,6 +27,8 @@ public class MapFixture : TestBase<ParsingService>
|
||||
private ParsedMovieInfo _translationTitleInfo;
|
||||
private ParsedMovieInfo _umlautInfo;
|
||||
private ParsedMovieInfo _umlautAltInfo;
|
||||
private ParsedMovieInfo _multiLanguageInfo;
|
||||
private ParsedMovieInfo _multiLanguageWithOriginalInfo;
|
||||
private MovieSearchCriteria _movieSearchCriteria;
|
||||
|
||||
[SetUp]
|
||||
@ -97,6 +99,18 @@ public void Setup()
|
||||
Year = _movie.Year
|
||||
};
|
||||
|
||||
_multiLanguageInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Languages = new List<Language> { Language.Original, Language.French }
|
||||
};
|
||||
|
||||
_multiLanguageWithOriginalInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Languages = new List<Language> { Language.Original, Language.French, Language.English }
|
||||
};
|
||||
|
||||
_movieSearchCriteria = new MovieSearchCriteria
|
||||
{
|
||||
Movie = _movie
|
||||
@ -180,5 +194,20 @@ public void should_match_umlauts()
|
||||
Subject.Map(_umlautInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
Subject.Map(_umlautAltInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_convert_original()
|
||||
{
|
||||
Subject.Map(_multiLanguageInfo, "", _movieSearchCriteria).RemoteMovie.ParsedMovieInfo.Languages.Should().Contain(Language.English);
|
||||
Subject.Map(_multiLanguageInfo, "", _movieSearchCriteria).RemoteMovie.ParsedMovieInfo.Languages.Should().Contain(Language.French);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_remove_original_as_already_exists()
|
||||
{
|
||||
Subject.Map(_multiLanguageWithOriginalInfo, "", _movieSearchCriteria).RemoteMovie.ParsedMovieInfo.Languages.Should().Contain(Language.English);
|
||||
Subject.Map(_multiLanguageWithOriginalInfo, "", _movieSearchCriteria).RemoteMovie.ParsedMovieInfo.Languages.Should().Contain(Language.French);
|
||||
Subject.Map(_multiLanguageWithOriginalInfo, "", _movieSearchCriteria).RemoteMovie.ParsedMovieInfo.Languages.Should().NotContain(Language.Original);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +139,15 @@ public MappingResult Map(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchC
|
||||
_logger.Debug("Language couldn't be parsed from release, fallback to movie original language: {0}", result.Movie.OriginalLanguage.Name);
|
||||
}
|
||||
|
||||
if (parsedMovieInfo.Languages.Contains(Language.Original))
|
||||
{
|
||||
parsedMovieInfo.Languages.Remove(Language.Original);
|
||||
if (!parsedMovieInfo.Languages.Contains(result.Movie.OriginalLanguage))
|
||||
{
|
||||
parsedMovieInfo.Languages.Add(result.Movie.OriginalLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
result.RemoteMovie.ParsedMovieInfo = parsedMovieInfo;
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user