Fixed: Avoid upgrades for custom formats cut-off already met

pull/6523/head
Bogdan 1 year ago committed by Mark McDowall
parent 6f6036a199
commit 8dd8c95f36

@ -46,28 +46,37 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false; return false;
} }
var qualityRevisionComapre = newQuality?.Revision.CompareTo(currentQuality.Revision); 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 (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer && if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionComapre > 0) qualityRevisionCompare > 0)
{ {
_logger.Debug("New item has a better quality revision, skipping. Existing: {0}. New: {1}", currentQuality, newQuality); _logger.Debug("New item has a better quality revision, skipping. Existing: {0}. New: {1}", currentQuality, newQuality);
return true; return true;
} }
var currentFormatScore = qualityProfile.CalculateCustomFormatScore(currentCustomFormats);
var newFormatScore = qualityProfile.CalculateCustomFormatScore(newCustomFormats);
// Reject unless the user does not prefer propers/repacks and it's a revision downgrade. // Reject unless the user does not prefer propers/repacks and it's a revision downgrade.
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer && if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionComapre < 0) qualityRevisionCompare < 0)
{ {
_logger.Debug("Existing item has a better quality revision, skipping. Existing: {0}. New: {1}", currentQuality, newQuality); _logger.Debug("Existing item has a better quality revision, skipping. Existing: {0}. New: {1}", currentQuality, newQuality);
return false; return false;
} }
var currentFormatScore = qualityProfile.CalculateCustomFormatScore(currentCustomFormats);
var newFormatScore = qualityProfile.CalculateCustomFormatScore(newCustomFormats);
if (qualityProfile.UpgradeAllowed && currentFormatScore >= qualityProfile.CutoffFormatScore)
{
_logger.Debug("Existing item meets cut-off for custom formats, skipping. Existing: [{0}] ({1}). Cutoff score: {2}",
currentCustomFormats.ConcatToString(),
currentFormatScore,
qualityProfile.CutoffFormatScore);
return false;
}
if (newFormatScore <= currentFormatScore) if (newFormatScore <= currentFormatScore)
{ {
_logger.Debug("New item's custom formats [{0}] ({1}) do not improve on [{2}] ({3}), skipping", _logger.Debug("New item's custom formats [{0}] ({1}) do not improve on [{2}] ({3}), skipping",
@ -123,7 +132,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return true; return true;
} }
_logger.Debug("Existing item meets cut-off. skipping. Existing: {0}", currentQuality); _logger.Debug("Existing item meets cut-off, skipping. Existing: {0}", currentQuality);
return false; return false;
} }

Loading…
Cancel
Save