1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Fixed: Incorrectly grabbing revision downgrades

Closes #4431
This commit is contained in:
Mark McDowall
2021-04-10 14:59:28 -07:00
parent d7e9ccde8e
commit 5114c75cbb
2 changed files with 29 additions and 3 deletions
@@ -39,6 +39,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
var qualityComparer = new QualityModelComparer(qualityProfile);
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
if (qualityCompare > 0)
{
@@ -52,15 +53,25 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false;
}
var qualityRevisionComapre = newQuality?.Revision.CompareTo(currentQuality.Revision);
// Accept unless the user doesn't want to prefer propers, optionally they can
// use preferred words to prefer propers/repacks over non-propers/repacks.
if (_configService.DownloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
newQuality?.Revision.CompareTo(currentQuality.Revision) > 0)
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionComapre > 0)
{
_logger.Debug("New item has a better quality revision");
return true;
}
// Reject unless the user does not prefer propers/repacks and it's a revision downgrade.
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionComapre < 0)
{
_logger.Debug("Existing item has a better quality revision, skipping");
return false;
}
var languageCompare = new LanguageComparer(languageProfile).Compare(newLanguage, currentLanguage);
if (languageCompare > 0)
@@ -77,7 +88,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
if (!IsPreferredWordUpgradable(currentScore, newScore))
{
_logger.Debug("Existing item has a better preferred word score, skipping");
_logger.Debug("Existing item has an equal or better preferred word score, skipping");
return false;
}