Fixed: All Imports show as Multi due to duplicated langs

pull/2/head
Qstick 4 years ago
parent 2b5dc59a36
commit 965ed041ae

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
{
_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 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
_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 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
_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 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
_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 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
_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 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Aggregation.Aggregators
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 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Aggregation.Aggregators
_logger.Debug("Using languages: {0}", languages.Select(l => l.Name).ToList().Join(","));
localMovie.Languages = languages;
localMovie.Languages = languages.Distinct().ToList();
return localMovie;
}

Loading…
Cancel
Save