mirror of
https://github.com/Readarr/Readarr
synced 2026-04-17 10:20:57 +02:00
minor fixes to build - half finished
This commit is contained in:
parent
baa728f2c1
commit
91d6fe90cd
2 changed files with 19 additions and 24 deletions
|
|
@ -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 @@ public UpgradableSpecification(IConfigService configService, Logger logger)
|
|||
_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 @@ private ProfileComparisonResult IsQualityUpgradable(QualityProfile profile, List
|
|||
|
||||
// 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 @@ private bool IsPreferredWordUpgradable(int currentScore, int newScore)
|
|||
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 @@ public virtual Decision IsSatisfiedBy(RemoteBook subject, SearchCriteriaBase sea
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue