1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-27 23:06:29 -04:00

Fixed: Aggregating media files with 576p resolution

This commit is contained in:
Mark McDowall
2024-09-21 08:55:05 -07:00
committed by Mark McDowall
parent 4b72a0a4e8
commit ca38a9b577
4 changed files with 78 additions and 0 deletions
@@ -170,5 +170,41 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
result.Quality.Revision.Version.Should().Be(2);
result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name);
}
[Test]
public void should_return_Bluray576p_when_Bluray_came_from_name_and_mediainfo_indicates_576p()
{
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(QualitySource.Bluray, Confidence.Default, 480, Confidence.Default, new Revision(0), Confidence.Tag));
_mediaInfoAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Returns(AugmentQualityResult.ResolutionOnly(576, Confidence.MediaInfo));
GivenAugmenters(_nameAugmenter, _mediaInfoAugmenter);
var result = Subject.Aggregate(new LocalEpisode(), null);
result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Name);
result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo);
result.Quality.Quality.Should().Be(Quality.Bluray576p);
}
[Test]
public void should_return_SDTV_when_HDTV_came_from_name_and_mediainfo_indicates_576p()
{
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(QualitySource.Television, Confidence.Default, 480, Confidence.Default, new Revision(0), Confidence.Tag));
_mediaInfoAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Returns(AugmentQualityResult.ResolutionOnly(576, Confidence.MediaInfo));
GivenAugmenters(_nameAugmenter, _mediaInfoAugmenter);
var result = Subject.Aggregate(new LocalEpisode(), null);
result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Name);
result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo);
result.Quality.Quality.Should().Be(Quality.SDTV);
}
}
}
@@ -47,6 +47,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators.Au
[TestCase(1490, 1, 720)]
[TestCase(1280, 1, 720)] // HD
[TestCase(1200, 1, 720)]
[TestCase(1000, 1, 576)]
[TestCase(720, 576, 576)]
[TestCase(800, 1, 480)]
[TestCase(720, 1, 480)] // SDTV
[TestCase(600, 1, 480)]
@@ -108,5 +110,25 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators.Au
result.Resolution.Should().Be(1080);
result.Source.Should().Be(QualitySource.Unknown);
}
[Test]
public void should_include_source_for_576_if_extracted_from_title()
{
var mediaInfo = Builder<MediaInfoModel>.CreateNew()
.With(m => m.Width = 1024)
.With(m => m.Height = 576)
.With(m => m.Title = "Series.Title.S01E05.Bluray.x264-Sonarr")
.Build();
var localEpisode = Builder<LocalEpisode>.CreateNew()
.With(l => l.MediaInfo = mediaInfo)
.Build();
var result = Subject.AugmentQuality(localEpisode, null);
result.Should().NotBe(null);
result.Resolution.Should().Be(576);
result.Source.Should().Be(QualitySource.Bluray);
}
}
}