Better trace messaging for Download Decision specs

Fixed: Trace logs will contain more details when a release is rejected
pull/4/head
Mark McDowall 11 years ago
parent 2b5c512d64
commit d648056bc4

@ -41,7 +41,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
if (quality == Quality.Unknown) if (quality == Quality.Unknown)
{ {
_logger.Trace("Unknown quality. skipping size check."); _logger.Trace("Unknown quality. skipping size check.");
return false; return true;
} }
var qualityDefinition = _qualityDefinitionService.Get(quality); var qualityDefinition = _qualityDefinitionService.Get(quality);

@ -37,7 +37,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
if (_blacklistService.Blacklisted(subject.Release.Title)) if (_blacklistService.Blacklisted(subject.Release.Title))
{ {
_logger.Trace("{0} is blacklisted", subject.Release.Title); _logger.Trace("{0} is blacklisted, rejecting.", subject.Release.Title);
return false; return false;
} }

@ -33,6 +33,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
if (!_qualityUpgradableSpecification.CutoffNotMet(subject.Series.QualityProfile, file.Quality, subject.ParsedEpisodeInfo.Quality)) if (!_qualityUpgradableSpecification.CutoffNotMet(subject.Series.QualityProfile, file.Quality, subject.ParsedEpisodeInfo.Quality))
{ {
_logger.Trace("Cutoff already met, rejecting.");
return false; return false;
} }
} }

@ -40,7 +40,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var queue = downloadClient.GetQueue().Select(q => q.RemoteEpisode); var queue = downloadClient.GetQueue().Select(q => q.RemoteEpisode);
return !IsInQueue(subject, queue); if (IsInQueue(subject, queue))
{
_logger.Trace("Already in queue, rejecting.");
}
return true;
} }
private bool IsInQueue(RemoteEpisode newEpisode, IEnumerable<RemoteEpisode> queue) private bool IsInQueue(RemoteEpisode newEpisode, IEnumerable<RemoteEpisode> queue)

@ -1,16 +1,24 @@
using NzbDrone.Core.IndexerSearch.Definitions; using NLog;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications namespace NzbDrone.Core.DecisionEngine.Specifications
{ {
public class NotSampleSpecification : IDecisionEngineSpecification public class NotSampleSpecification : IDecisionEngineSpecification
{ {
private readonly Logger _logger;
public string RejectionReason { get { return "Sample"; } } public string RejectionReason { get { return "Sample"; } }
public NotSampleSpecification(Logger logger)
{
_logger = logger;
}
public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria) public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
{ {
if (subject.Release.Title.ToLower().Contains("sample") && subject.Release.Size < 70.Megabytes()) if (subject.Release.Title.ToLower().Contains("sample") && subject.Release.Size < 70.Megabytes())
{ {
_logger.Trace("Sample release, rejecting.");
return false; return false;
} }

@ -51,6 +51,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
if (mostRecent != null && mostRecent.EventType == HistoryEventType.Grabbed) if (mostRecent != null && mostRecent.EventType == HistoryEventType.Grabbed)
{ {
_logger.Trace("Latest history item is downloading, rejecting.");
return false; return false;
} }
} }

@ -41,7 +41,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{ {
if (file.DateAdded < DateTime.Today.AddDays(-7)) if (file.DateAdded < DateTime.Today.AddDays(-7))
{ {
_logger.Trace("Proper for old file, skipping: {0}", subject); _logger.Trace("Proper for old file, rejecting: {0}", subject);
return false; return false;
} }

Loading…
Cancel
Save