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

Fixed: Custom Formats upgrading even when profile doesn't allow upgrades

Closes #5330
This commit is contained in:
Mark McDowall
2023-01-04 13:41:12 -08:00
committed by GitHub
parent 3316665e93
commit fe5c52602a
4 changed files with 145 additions and 108 deletions
@@ -1,5 +1,6 @@
using System.Linq;
using NLog;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
@@ -8,11 +9,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public class UpgradeAllowedSpecification : IDecisionEngineSpecification
{
private readonly UpgradableSpecification _upgradableSpecification;
private readonly ICustomFormatCalculationService _formatService;
private readonly Logger _logger;
public UpgradeAllowedSpecification(UpgradableSpecification upgradableSpecification, Logger logger)
public UpgradeAllowedSpecification(UpgradableSpecification upgradableSpecification,
ICustomFormatCalculationService formatService,
Logger logger)
{
_upgradableSpecification = upgradableSpecification;
_formatService = formatService;
_logger = logger;
}
@@ -31,11 +36,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
continue;
}
var fileCustomFormats = _formatService.ParseCustomFormat(file, subject.Series);
_logger.Debug("Comparing file quality with report. Existing file is {0}", file.Quality);
if (!_upgradableSpecification.IsUpgradeAllowed(qualityProfile,
file.Quality,
subject.ParsedEpisodeInfo.Quality))
fileCustomFormats,
subject.ParsedEpisodeInfo.Quality,
subject.CustomFormats))
{
_logger.Debug("Upgrading is not allowed by the quality profile");