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

Add reason enum to decision engine rejections

Co-authored-by: Mark McDowall <mark@mcdowall.ca>
This commit is contained in:
Bogdan
2025-02-02 19:15:46 +02:00
parent cd836fef38
commit 7977e0be05
70 changed files with 560 additions and 430 deletions
@@ -8,7 +8,7 @@ using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
public class FreeSpaceSpecification : IDecisionEngineSpecification
public class FreeSpaceSpecification : IDownloadDecisionEngineSpecification
{
private readonly IConfigService _configService;
private readonly IDiskProvider _diskProvider;
@@ -24,12 +24,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public SpecificationPriority Priority => SpecificationPriority.Default;
public RejectionType Type => RejectionType.Permanent;
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
public DownloadSpecDecision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
if (_configService.SkipFreeSpaceCheckWhenImporting)
{
_logger.Debug("Skipping free space check");
return Decision.Accept();
return DownloadSpecDecision.Accept();
}
var size = subject.Release.Size;
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
_logger.Debug("Unable to get available space for {0}. Skipping", path);
return Decision.Accept();
return DownloadSpecDecision.Accept();
}
var minimumSpace = _configService.MinimumFreeSpaceWhenImporting.Megabytes();
@@ -60,7 +60,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var message = "Importing after download will exceed available disk space";
_logger.Debug(message);
return Decision.Reject(message);
return DownloadSpecDecision.Reject(DownloadRejectionReason.MinimumFreeSpace, message);
}
if (remainingSpace < minimumSpace)
@@ -68,10 +68,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var message = $"Not enough free space ({minimumSpace.SizeSuffix()}) to import after download: {remainingSpace.SizeSuffix()}. (Settings: Media Management: Minimum Free Space)";
_logger.Debug(message);
return Decision.Reject(message);
return DownloadSpecDecision.Reject(DownloadRejectionReason.MinimumFreeSpace, message);
}
return Decision.Accept();
return DownloadSpecDecision.Accept();
}
}
}