mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Use folder quality when better than file quality (regression)
Closes #1022
This commit is contained in:
parent
376481eda5
commit
b62ef0c40c
@ -207,6 +207,22 @@ public void should_use_folder_quality_when_file_quality_was_determined_by_the_ex
|
|||||||
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_use_folder_quality_when_greater_than_file_quality()
|
||||||
|
{
|
||||||
|
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||||
|
GivenVideoFiles(new string[] { @"C:\Test\Unsorted\The.Office.S03E115.mkv".AsOsAgnostic() });
|
||||||
|
|
||||||
|
_localEpisode.Path = _videoFiles.Single();
|
||||||
|
_localEpisode.Quality.Quality = Quality.HDTV720p;
|
||||||
|
|
||||||
|
var expectedQuality = new QualityModel(Quality.Bluray720p);
|
||||||
|
|
||||||
|
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
||||||
|
|
||||||
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_throw_if_episodes_are_not_found()
|
public void should_not_throw_if_episodes_are_not_found()
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ private bool ShouldUseFolderName(List<string> videoFiles, Series series, ParsedE
|
|||||||
|
|
||||||
private QualityModel GetQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Series series)
|
private QualityModel GetQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Series series)
|
||||||
{
|
{
|
||||||
if (folderInfo != null && folderInfo.Quality.Quality != Quality.Unknown && fileQuality.QualitySource == QualitySource.Extension)
|
if (UseFolderQuality(folderInfo, fileQuality, series))
|
||||||
{
|
{
|
||||||
_logger.Debug("Using quality from folder: {0}", folderInfo.Quality);
|
_logger.Debug("Using quality from folder: {0}", folderInfo.Quality);
|
||||||
return folderInfo.Quality;
|
return folderInfo.Quality;
|
||||||
@ -189,5 +189,30 @@ private QualityModel GetQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQ
|
|||||||
|
|
||||||
return fileQuality;
|
return fileQuality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool UseFolderQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Series series)
|
||||||
|
{
|
||||||
|
if (folderInfo == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (folderInfo.Quality.Quality == Quality.Unknown)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileQuality.QualitySource == QualitySource.Extension)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new QualityModelComparer(series.Profile).Compare(folderInfo.Quality, fileQuality) > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user