mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed a bunch of specs that handled propers and cutoffs
This commit is contained in:
@@ -10,16 +10,15 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
bool IsUpgradable(QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool IsProperUpgrade(QualityModel currentQuality, QualityModel newQuality);
|
||||
}
|
||||
|
||||
public class QualityUpgradableSpecification : IQualityUpgradableSpecification
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public QualityUpgradableSpecification(IConfigService configService, Logger logger)
|
||||
public QualityUpgradableSpecification(Logger logger)
|
||||
{
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -33,9 +32,8 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currentQuality.Quality == newQuality.Quality && newQuality.Proper && _configService.AutoDownloadPropers)
|
||||
if (IsProperUpgrade(currentQuality, newQuality))
|
||||
{
|
||||
_logger.Trace("Upgrading existing item to proper.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -47,11 +45,27 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
if (currentQuality.Quality >= profile.Cutoff)
|
||||
{
|
||||
if (newQuality != null && IsProperUpgrade(currentQuality, newQuality))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.Trace("Existing item meets cut-off. skipping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsProperUpgrade(QualityModel currentQuality, QualityModel newQuality)
|
||||
{
|
||||
if (currentQuality.Quality == newQuality.Quality && newQuality > currentQuality)
|
||||
{
|
||||
_logger.Trace("New quality is a proper for existing quality");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user