mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
minor fixes to build - half finished
This commit is contained in:
@@ -9,7 +9,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
{
|
||||
public interface IUpgradableSpecification
|
||||
{
|
||||
bool IsUpgradable(QualityProfile profile, List<QualityModel> currentQualities, int currentScore, QualityModel newQuality, int newScore);
|
||||
bool IsUpgradable(QualityProfile profile, QualityModel currentQualities, int currentScore, QualityModel newQuality, int newScore);
|
||||
bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool CutoffNotMet(QualityProfile profile, List<QualityModel> currentQualities, int currentScore, QualityModel newQuality = null, int newScore = 0);
|
||||
bool IsRevisionUpgrade(QualityModel currentQuality, QualityModel newQuality);
|
||||
@@ -27,23 +27,20 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private ProfileComparisonResult IsQualityUpgradable(QualityProfile profile, List<QualityModel> currentQualities, QualityModel newQuality = null)
|
||||
private ProfileComparisonResult IsQualityUpgradable(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
|
||||
{
|
||||
if (newQuality != null)
|
||||
{
|
||||
var totalCompare = 0;
|
||||
|
||||
foreach (var quality in currentQualities)
|
||||
var compare = new QualityModelComparer(profile).Compare(newQuality, currentQuality);
|
||||
|
||||
totalCompare += compare;
|
||||
|
||||
if (compare < 0)
|
||||
{
|
||||
var compare = new QualityModelComparer(profile).Compare(newQuality, quality);
|
||||
|
||||
totalCompare += compare;
|
||||
|
||||
if (compare < 0)
|
||||
{
|
||||
// Not upgradable if new quality is a downgrade for any current quality
|
||||
return ProfileComparisonResult.Downgrade;
|
||||
}
|
||||
// Not upgradable if new quality is a downgrade for any current quality
|
||||
return ProfileComparisonResult.Downgrade;
|
||||
}
|
||||
|
||||
// Not upgradable if new quality is equal to all current qualities
|
||||
@@ -54,7 +51,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
|
||||
// Quality Treated as Equal if Propers are not Prefered
|
||||
if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer &&
|
||||
newQuality.Revision.CompareTo(currentQualities.Min(q => q.Revision)) > 0)
|
||||
newQuality.Revision.CompareTo(currentQualities(q => q.Revision)) > 0)
|
||||
{
|
||||
return ProfileComparisonResult.Equal;
|
||||
}
|
||||
@@ -70,7 +67,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
return newScore > currentScore;
|
||||
}
|
||||
|
||||
public bool IsUpgradable(QualityProfile qualityProfile, List<QualityModel> currentQualities, int currentScore, QualityModel newQuality, int newScore)
|
||||
public bool IsUpgradable(QualityProfile qualityProfile, QualityModel currentQualities, int currentScore, QualityModel newQuality, int newScore)
|
||||
{
|
||||
var qualityUpgrade = IsQualityUpgradable(qualityProfile, currentQualities, newQuality);
|
||||
|
||||
|
||||
@@ -32,18 +32,16 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
{
|
||||
if (file == null)
|
||||
{
|
||||
_logger.Debug("File is no longer available, skipping this file.");
|
||||
continue;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
if (!_upgradableSpecification.IsUpgradable(subject.Author.QualityProfile,
|
||||
currentQualities,
|
||||
_preferredWordServiceCalculator.Calculate(subject.Author, file.GetSceneOrFileName(), subject.Release?.IndexerId ?? 0),
|
||||
subject.ParsedBookInfo.Quality,
|
||||
subject.PreferredWordScore))
|
||||
{
|
||||
return Decision.Reject("Existing files on disk is of equal or higher preference: {0}", currentQualities.ConcatToString());
|
||||
}
|
||||
if (!_upgradableSpecification.IsUpgradable(subject.Author.QualityProfile,
|
||||
file.Quality,
|
||||
_preferredWordServiceCalculator.Calculate(subject.Author, file.GetSceneOrFileName(), subject.Release?.IndexerId ?? 0),
|
||||
subject.ParsedBookInfo.Quality,
|
||||
subject.PreferredWordScore))
|
||||
{
|
||||
return Decision.Reject("Existing files on disk is of equal or higher preference: {0}", file.Quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user