mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-21 22:05:38 -04:00
Download decision rejection reasons are no longer static messages
New: Better messaging on manual search when release is rejected
This commit is contained in:
@@ -21,17 +21,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Waiting for better quality release";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Temporary; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
//How do we want to handle drone being off and the automatic search being triggered?
|
||||
//TODO: Add a flag to the search to state it is a "scheduled" search
|
||||
@@ -39,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
_logger.Debug("Ignore delay for searches");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
var profile = subject.Series.Profile.Value;
|
||||
@@ -47,7 +39,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (profile.GrabDelay == 0)
|
||||
{
|
||||
_logger.Debug("Profile does not delay before download");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
var comparer = new QualityModelComparer(profile);
|
||||
@@ -63,7 +55,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (revisionUpgrade)
|
||||
{
|
||||
_logger.Debug("New quality is a better revision for existing quality, skipping delay");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,7 +67,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (bestCompare >= 0)
|
||||
{
|
||||
_logger.Debug("Quality is highest in profile, will not delay");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
if (profile.GrabDelayMode == GrabDelayMode.Cutoff)
|
||||
@@ -86,7 +78,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (cutoffCompare >= 0)
|
||||
{
|
||||
_logger.Debug("Quality meets or exceeds the cutoff, will not delay");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,17 +93,17 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
|
||||
if (oldest != null && oldest.Release.AgeHours > profile.GrabDelay)
|
||||
{
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
|
||||
if (subject.Release.AgeHours < profile.GrabDelay)
|
||||
{
|
||||
_logger.Debug("Age ({0}) is less than delay {1}, delaying", subject.Release.AgeHours, profile.GrabDelay);
|
||||
return false;
|
||||
return Decision.Reject("Waiting for better quality release");
|
||||
}
|
||||
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,22 +26,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Existing file in history is of equal or higher quality";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
_logger.Debug("Skipping history check during search");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
var downloadClients = _downloadClientProvider.GetDownloadClients();
|
||||
@@ -57,10 +49,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (mostRecent != null && mostRecent.EventType == HistoryEventType.Grabbed)
|
||||
{
|
||||
_logger.Debug("Latest history item is downloading, rejecting.");
|
||||
return false;
|
||||
return Decision.Reject("Download has not been imported yet");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
foreach (var episode in subject.Episodes)
|
||||
@@ -69,12 +61,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (bestQualityInHistory != null)
|
||||
{
|
||||
_logger.Debug("Comparing history quality with report. History is {0}", bestQualityInHistory);
|
||||
|
||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.Profile, bestQualityInHistory, subject.ParsedEpisodeInfo.Quality))
|
||||
return false;
|
||||
{
|
||||
return Decision.Reject("Existing file in history is of equal or higher quality: {0}", bestQualityInHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-13
@@ -14,38 +14,30 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Series or Episode is not monitored";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
_logger.Debug("Skipping monitored check during search");
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
if (!subject.Series.Monitored)
|
||||
{
|
||||
_logger.Debug("{0} is present in the DB but not tracked. skipping.", subject.Series);
|
||||
return false;
|
||||
return Decision.Reject("Series is not monitored");
|
||||
}
|
||||
|
||||
//return monitored if any of the episodes are monitored
|
||||
if (subject.Episodes.Any(episode => episode.Monitored))
|
||||
{
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
_logger.Debug("No episodes are monitored. skipping.");
|
||||
return false;
|
||||
return Decision.Reject("Episode is not monitored");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,21 +20,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Proper for old episode";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
foreach (var file in subject.Episodes.Where(c => c.EpisodeFileId != 0).Select(c => c.EpisodeFile.Value))
|
||||
@@ -44,18 +36,18 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
if (file.DateAdded < DateTime.Today.AddDays(-7))
|
||||
{
|
||||
_logger.Debug("Proper for old file, rejecting: {0}", subject);
|
||||
return false;
|
||||
return Decision.Reject("Proper for old file");
|
||||
}
|
||||
|
||||
if (!_configService.AutoDownloadPropers)
|
||||
{
|
||||
_logger.Debug("Auto downloading of propers is disabled");
|
||||
return false;
|
||||
return Decision.Reject("Proper downloading is disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user