mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: All Imports show as Multi due to duplicated langs
This commit is contained in:
parent
2b5dc59a36
commit
965ed041ae
@ -43,7 +43,7 @@ public void should_return_file_language_when_only_file_info_is_known()
|
||||
{
|
||||
_localMovie.FileMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Contain(_localMovie.FileMovieInfo.Languages);
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Equal(_localMovie.FileMovieInfo.Languages);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -52,7 +52,9 @@ public void should_return_folder_language_when_folder_info_is_known()
|
||||
_localMovie.FolderMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
_localMovie.FileMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Contain(_localMovie.FolderMovieInfo.Languages);
|
||||
var aggregation = Subject.Aggregate(_localMovie, false);
|
||||
|
||||
aggregation.Languages.Should().Equal(_localMovie.FolderMovieInfo.Languages);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -62,7 +64,7 @@ public void should_return_download_client_item_language_when_download_client_ite
|
||||
_localMovie.FolderMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
_localMovie.FileMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Contain(_localMovie.DownloadClientMovieInfo.Languages);
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Equal(_localMovie.DownloadClientMovieInfo.Languages);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -72,7 +74,7 @@ public void should_return_file_language_when_file_language_is_higher_than_others
|
||||
_localMovie.FolderMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
_localMovie.FileMovieInfo = GetParsedMovieInfo(new List<Language> { Language.French });
|
||||
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Contain(_localMovie.FileMovieInfo.Languages);
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Equal(_localMovie.FileMovieInfo.Languages);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -82,7 +84,7 @@ public void should_return_multi_language()
|
||||
_localMovie.FolderMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English, Language.German });
|
||||
_localMovie.FileMovieInfo = GetParsedMovieInfo(new List<Language> { Language.English });
|
||||
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Contain(_localMovie.FolderMovieInfo.Languages);
|
||||
Subject.Aggregate(_localMovie, false).Languages.Should().Equal(_localMovie.FolderMovieInfo.Languages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ public LocalMovie Aggregate(LocalMovie localMovie, bool otherFiles)
|
||||
|
||||
if (!languages.Any(l => l != Language.English))
|
||||
{
|
||||
languages.AddRange(localMovie.FolderMovieInfo?.Languages ?? new List<Language>());
|
||||
languages = localMovie.FolderMovieInfo?.Languages ?? new List<Language>();
|
||||
}
|
||||
|
||||
if (!languages.Any(l => l != Language.English))
|
||||
{
|
||||
languages.AddRange(localMovie.FileMovieInfo?.Languages ?? new List<Language>());
|
||||
languages = localMovie.FileMovieInfo?.Languages ?? new List<Language>();
|
||||
}
|
||||
|
||||
if (!languages.Any())
|
||||
@ -42,7 +42,7 @@ public LocalMovie Aggregate(LocalMovie localMovie, bool otherFiles)
|
||||
|
||||
_logger.Debug("Using languages: {0}", languages.Select(l => l.Name).ToList().Join(","));
|
||||
|
||||
localMovie.Languages = languages;
|
||||
localMovie.Languages = languages.Distinct().ToList();
|
||||
|
||||
return localMovie;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user