mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-27 06:02:33 +01:00
Fixed: Incorrectly grabbing revision downgrades (#6194)
This commit is contained in:
parent
7807e2e13a
commit
ce6f52552a
@ -87,5 +87,13 @@ public void should_not_be_upgradable_if_qualities_are_the_same()
|
|||||||
_parseResultSingle.ParsedMovieInfo.Quality = new QualityModel(Quality.WEBDL1080p);
|
_parseResultSingle.ParsedMovieInfo.Quality = new QualityModel(Quality.WEBDL1080p);
|
||||||
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_be_upgradable_if_revision_downgrade_if_propers_are_preferred()
|
||||||
|
{
|
||||||
|
_firstFile.Quality = new QualityModel(Quality.WEBDL1080p, new Revision(2));
|
||||||
|
_parseResultSingle.ParsedMovieInfo.Quality = new QualityModel(Quality.WEBDL1080p);
|
||||||
|
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ public bool IsUpgradable(Profile profile, QualityModel currentQuality, List<Cust
|
|||||||
{
|
{
|
||||||
var qualityComparer = new QualityModelComparer(profile);
|
var qualityComparer = new QualityModelComparer(profile);
|
||||||
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
|
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
|
||||||
|
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
|
||||||
|
|
||||||
if (qualityCompare > 0)
|
if (qualityCompare > 0)
|
||||||
{
|
{
|
||||||
@ -45,10 +46,12 @@ public bool IsUpgradable(Profile profile, QualityModel currentQuality, List<Cust
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qualityRevisionCompare = newQuality?.Revision.CompareTo(currentQuality.Revision);
|
||||||
|
|
||||||
// Accept unless the user doesn't want to prefer propers, optionally they can
|
// Accept unless the user doesn't want to prefer propers, optionally they can
|
||||||
// use preferred words to prefer propers/repacks over non-propers/repacks.
|
// use preferred words to prefer propers/repacks over non-propers/repacks.
|
||||||
if (_configService.DownloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
||||||
newQuality?.Revision.CompareTo(currentQuality.Revision) > 0)
|
qualityRevisionCompare > 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,6 +59,14 @@ public bool IsUpgradable(Profile profile, QualityModel currentQuality, List<Cust
|
|||||||
var currentFormatScore = profile.CalculateCustomFormatScore(currentCustomFormats);
|
var currentFormatScore = profile.CalculateCustomFormatScore(currentCustomFormats);
|
||||||
var newFormatScore = profile.CalculateCustomFormatScore(newCustomFormats);
|
var newFormatScore = profile.CalculateCustomFormatScore(newCustomFormats);
|
||||||
|
|
||||||
|
// Reject unless the user does not prefer propers/repacks and it's a revision downgrade.
|
||||||
|
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
||||||
|
qualityRevisionCompare < 0)
|
||||||
|
{
|
||||||
|
_logger.Debug("Existing item has a better quality revision, skipping");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (newFormatScore <= currentFormatScore)
|
if (newFormatScore <= currentFormatScore)
|
||||||
{
|
{
|
||||||
_logger.Debug("New item's custom formats [{0}] do not improve on [{1}], skipping",
|
_logger.Debug("New item's custom formats [{0}] do not improve on [{1}], skipping",
|
||||||
|
Loading…
Reference in New Issue
Block a user