mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
Profiles
Indexes are created with the same uniqueness when copying a table New: Non-English episode support New: Renamed Quality Profiles to Profiles and made them more powerful New: Configurable wait time before grabbing a release to wait for a better quality
This commit is contained in:
+20
-5
@@ -2,12 +2,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public class DownloadDecision
|
||||
{
|
||||
public RemoteEpisode RemoteEpisode { get; private set; }
|
||||
public IEnumerable<string> Rejections { get; private set; }
|
||||
public IEnumerable<Rejection> Rejections { get; private set; }
|
||||
|
||||
public bool Approved
|
||||
{
|
||||
@@ -17,13 +17,28 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public DownloadDecision(RemoteEpisode episode, params string[] rejections)
|
||||
public bool TemporarilyRejected
|
||||
{
|
||||
get
|
||||
{
|
||||
return Rejections.Any() && Rejections.All(r => r.Type == RejectionType.Temporary);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Rejected
|
||||
{
|
||||
get
|
||||
{
|
||||
return Rejections.Any() && Rejections.All(r => r.Type == RejectionType.Permanent);
|
||||
}
|
||||
}
|
||||
|
||||
public DownloadDecision(RemoteEpisode episode, params Rejection[] rejections)
|
||||
{
|
||||
RemoteEpisode = episode;
|
||||
Rejections = rejections.ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (Approved)
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Parser;
|
||||
@@ -17,6 +16,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports);
|
||||
List<DownloadDecision> GetSearchDecision(List<ReleaseInfo> reports, SearchCriteriaBase searchCriteriaBase);
|
||||
DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null);
|
||||
}
|
||||
|
||||
public class DownloadDecisionMaker : IMakeDownloadDecision
|
||||
@@ -87,7 +87,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
}
|
||||
else
|
||||
{
|
||||
decision = new DownloadDecision(remoteEpisode, "Unknown Series");
|
||||
decision = new DownloadDecision(remoteEpisode, new Rejection("Unknown Series"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,19 +110,19 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
}
|
||||
}
|
||||
|
||||
private DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null)
|
||||
public DownloadDecision GetDecisionForReport(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria = null)
|
||||
{
|
||||
var reasons = _specifications.Select(c => EvaluateSpec(c, remoteEpisode, searchCriteria))
|
||||
.Where(c => !string.IsNullOrWhiteSpace(c));
|
||||
.Where(c => c != null);
|
||||
|
||||
return new DownloadDecision(remoteEpisode, reasons.ToArray());
|
||||
}
|
||||
|
||||
private string EvaluateSpec(IRejectWithReason spec, RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteriaBase = null)
|
||||
private Rejection EvaluateSpec(IRejectWithReason spec, RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteriaBase = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(spec.RejectionReason))
|
||||
if (spec.RejectionReason.IsNullOrWhiteSpace())
|
||||
{
|
||||
throw new InvalidOperationException("[Need Rejection Text]");
|
||||
}
|
||||
@@ -130,7 +130,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
var generalSpecification = spec as IDecisionEngineSpecification;
|
||||
if (generalSpecification != null && !generalSpecification.IsSatisfiedBy(remoteEpisode, searchCriteriaBase))
|
||||
{
|
||||
return spec.RejectionReason;
|
||||
return new Rejection(spec.RejectionReason, generalSpecification.Type);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -138,7 +138,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
e.Data.Add("report", remoteEpisode.Release.ToJson());
|
||||
e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson());
|
||||
_logger.ErrorException("Couldn't evaluate decision on " + remoteEpisode.Release.Title, e);
|
||||
return string.Format("{0}: {1}", spec.GetType().Name, e.Message);
|
||||
return new Rejection(String.Format("{0}: {1}", spec.GetType().Name, e.Message));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
return decisions
|
||||
.Where(c => c.RemoteEpisode.Series != null)
|
||||
.GroupBy(c => c.RemoteEpisode.Series.Id, (i, s) => s
|
||||
.OrderByDescending(c => c.RemoteEpisode.ParsedEpisodeInfo.Quality, new QualityModelComparer(s.First().RemoteEpisode.Series.QualityProfile))
|
||||
.OrderByDescending(c => c.RemoteEpisode.ParsedEpisodeInfo.Quality, new QualityModelComparer(s.First().RemoteEpisode.Series.Profile))
|
||||
.ThenBy(c => c.RemoteEpisode.Episodes.Select(e => e.EpisodeNumber).MinOrDefault())
|
||||
.ThenBy(c => c.RemoteEpisode.Release.Size.Round(200.Megabytes()) / Math.Max(1, c.RemoteEpisode.Episodes.Count))
|
||||
.ThenBy(c => c.RemoteEpisode.Release.Age))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
@@ -5,6 +6,8 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public interface IDecisionEngineSpecification : IRejectWithReason
|
||||
{
|
||||
bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria);
|
||||
RejectionType Type { get; }
|
||||
|
||||
Boolean IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria);
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,4 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
string RejectionReason { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public interface IQualityUpgradableSpecification
|
||||
{
|
||||
bool IsUpgradable(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool IsUpgradable(Profile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool CutoffNotMet(Profile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||
bool IsProperUpgrade(QualityModel currentQuality, QualityModel newQuality);
|
||||
}
|
||||
|
||||
@@ -19,7 +20,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool IsUpgradable(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
|
||||
public bool IsUpgradable(Profile profile, QualityModel currentQuality, QualityModel newQuality = null)
|
||||
{
|
||||
if (newQuality != null)
|
||||
{
|
||||
@@ -39,7 +40,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
|
||||
public bool CutoffNotMet(Profile profile, QualityModel currentQuality, QualityModel newQuality = null)
|
||||
{
|
||||
int compare = new QualityModelComparer(profile).Compare(currentQuality.Quality, profile.Cutoff);
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public class Rejection
|
||||
{
|
||||
public String Reason { get; set; }
|
||||
public RejectionType Type { get; set; }
|
||||
|
||||
public Rejection(string reason, RejectionType type = RejectionType.Permanent)
|
||||
{
|
||||
Reason = reason;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("[{0}] {1}", Type, Reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public enum RejectionType
|
||||
{
|
||||
Permanent = 0,
|
||||
Temporary = 1
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
@@ -21,12 +22,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
public String RejectionReason
|
||||
{
|
||||
get { return "File size too big or small"; }
|
||||
}
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
_logger.Debug("Beginning size check for: {0}", subject);
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (!_configService.EnableFailedDownloadHandling)
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
foreach (var file in subject.Episodes.Where(c => c.EpisodeFileId != 0).Select(c => c.EpisodeFile.Value))
|
||||
@@ -31,7 +33,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
_logger.Debug("Comparing file quality with report. Existing file is {0}", file.Quality);
|
||||
|
||||
|
||||
if (!_qualityUpgradableSpecification.CutoffNotMet(subject.Series.QualityProfile, file.Quality, subject.ParsedEpisodeInfo.Quality))
|
||||
if (!_qualityUpgradableSpecification.CutoffNotMet(subject.Series.Profile, file.Quality, subject.ParsedEpisodeInfo.Quality))
|
||||
{
|
||||
_logger.Debug("Cutoff already met, rejecting.");
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
@@ -18,16 +17,21 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Not English";
|
||||
return "Language is not wanted";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
var wantedLanguage = subject.Series.Profile.Value.Language;
|
||||
|
||||
_logger.Debug("Checking if report meets language requirements. {0}", subject.ParsedEpisodeInfo.Language);
|
||||
if (subject.ParsedEpisodeInfo.Language != Language.English)
|
||||
|
||||
if (subject.ParsedEpisodeInfo.Language != wantedLanguage)
|
||||
{
|
||||
_logger.Debug("Report Language: {0} rejected because it is not English", subject.ParsedEpisodeInfo.Language);
|
||||
_logger.Debug("Report Language: {0} rejected because it is not wanted, wanted {1}", subject.ParsedEpisodeInfo.Language, wantedLanguage);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
var queue = _downloadTrackingService.GetQueuedDownloads()
|
||||
@@ -46,7 +48,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
private bool IsInQueue(RemoteEpisode newEpisode, IEnumerable<RemoteEpisode> queue)
|
||||
{
|
||||
var matchingSeries = queue.Where(q => q.Series.Id == newEpisode.Series.Id);
|
||||
var matchingSeriesAndQuality = matchingSeries.Where(q => new QualityModelComparer(q.Series.QualityProfile).Compare(q.ParsedEpisodeInfo.Quality, newEpisode.ParsedEpisodeInfo.Quality) >= 0);
|
||||
var matchingSeriesAndQuality = matchingSeries.Where(q => new QualityModelComparer(q.Series.Profile).Compare(q.ParsedEpisodeInfo.Quality, newEpisode.ParsedEpisodeInfo.Quality) >= 0);
|
||||
|
||||
return matchingSeriesAndQuality.Any(q => q.Episodes.Select(e => e.Id).Intersect(newEpisode.Episodes.Select(e => e.Id)).Any());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
_logger.Debug("Checking if release contains any restricted terms: {0}", subject);
|
||||
|
||||
@@ -7,7 +7,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
public class NotSampleSpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public string RejectionReason { get { return "Sample"; } }
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public NotSampleSpecification(Logger logger)
|
||||
{
|
||||
|
||||
+3
-1
@@ -21,10 +21,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
_logger.Debug("Checking if report meets quality requirements. {0}", subject.ParsedEpisodeInfo.Quality);
|
||||
if (!subject.Series.QualityProfile.Value.Items.Exists(v => v.Allowed && v.Quality == subject.ParsedEpisodeInfo.Quality.Quality))
|
||||
if (!subject.Series.Profile.Value.Items.Exists(v => v.Allowed && v.Quality == subject.ParsedEpisodeInfo.Quality.Quality))
|
||||
{
|
||||
_logger.Debug("Quality {0} rejected by Series' quality profile", subject.ParsedEpisodeInfo.Quality);
|
||||
return false;
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
var age = subject.Release.Age;
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (!_configService.EnableFailedDownloadHandling)
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
{
|
||||
public class DelaySpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly IPendingReleaseService _pendingReleaseService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DelaySpecification(IPendingReleaseService pendingReleaseService, Logger logger)
|
||||
{
|
||||
_pendingReleaseService = pendingReleaseService;
|
||||
_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)
|
||||
{
|
||||
//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
|
||||
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
_logger.Debug("Ignore delay for searches");
|
||||
return true;
|
||||
}
|
||||
|
||||
var profile = subject.Series.Profile.Value;
|
||||
|
||||
if (profile.GrabDelay == 0)
|
||||
{
|
||||
_logger.Debug("Profile does not delay before download");
|
||||
return true;
|
||||
}
|
||||
|
||||
var comparer = new QualityModelComparer(profile);
|
||||
|
||||
if (subject.ParsedEpisodeInfo.Quality.Proper)
|
||||
{
|
||||
foreach (var file in subject.Episodes.Where(c => c.EpisodeFileId != 0).Select(c => c.EpisodeFile.Value))
|
||||
{
|
||||
if (comparer.Compare(subject.ParsedEpisodeInfo.Quality, file.Quality) > 0)
|
||||
{
|
||||
var properCompare = subject.ParsedEpisodeInfo.Quality.Proper.CompareTo(file.Quality.Proper);
|
||||
|
||||
if (subject.ParsedEpisodeInfo.Quality.Quality == file.Quality.Quality && properCompare > 0)
|
||||
{
|
||||
_logger.Debug("New quality is a proper for existing quality, skipping delay");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If quality meets or exceeds the best allowed quality in the profile accept it immediately
|
||||
var bestQualityInProfile = new QualityModel(profile.Items.Last(q => q.Allowed).Quality);
|
||||
var bestCompare = comparer.Compare(subject.ParsedEpisodeInfo.Quality, bestQualityInProfile);
|
||||
|
||||
if (bestCompare >= 0)
|
||||
{
|
||||
_logger.Debug("Quality is highest in profile, will not delay");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.GrabDelayMode == GrabDelayMode.Cutoff)
|
||||
{
|
||||
var cutoff = new QualityModel(profile.Cutoff);
|
||||
var cutoffCompare = comparer.Compare(subject.ParsedEpisodeInfo.Quality, cutoff);
|
||||
|
||||
if (cutoffCompare >= 0)
|
||||
{
|
||||
_logger.Debug("Quality meets or exceeds the cutoff, will not delay");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.GrabDelayMode == GrabDelayMode.First)
|
||||
{
|
||||
var episodeIds = subject.Episodes.Select(e => e.Id);
|
||||
|
||||
var oldest = _pendingReleaseService.GetPendingRemoteEpisodes(subject.Series.Id)
|
||||
.Where(r => r.Episodes.Select(e => e.Id).Intersect(episodeIds).Any())
|
||||
.OrderByDescending(p => p.Release.AgeHours)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (oldest != null && oldest.Release.AgeHours > profile.GrabDelay)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (subject.Release.AgeHours < profile.GrabDelay)
|
||||
{
|
||||
_logger.Debug("Age ({0}) is less than delay {1}, delaying", subject.Release.AgeHours, profile.GrabDelay);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
@@ -63,11 +65,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
|
||||
foreach (var episode in subject.Episodes)
|
||||
{
|
||||
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.QualityProfile, episode.Id);
|
||||
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.Profile, episode.Id);
|
||||
if (bestQualityInHistory != null)
|
||||
{
|
||||
_logger.Debug("Comparing history quality with report. History is {0}", bestQualityInHistory);
|
||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, bestQualityInHistory, subject.ParsedEpisodeInfo.Quality))
|
||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.Profile, bestQualityInHistory, subject.ParsedEpisodeInfo.Quality))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
|
||||
+3
@@ -23,6 +23,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
return "Episode doesn't match";
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria == null)
|
||||
|
||||
+2
@@ -23,6 +23,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria == null)
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria == null)
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria == null)
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria == null)
|
||||
|
||||
@@ -24,13 +24,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
}
|
||||
}
|
||||
|
||||
public RejectionType Type { get { return RejectionType.Permanent; } }
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
foreach (var file in subject.Episodes.Where(c => c.EpisodeFileId != 0).Select(c => c.EpisodeFile.Value))
|
||||
{
|
||||
_logger.Debug("Comparing file quality with report. Existing file is {0}", file.Quality);
|
||||
|
||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, file.Quality, subject.ParsedEpisodeInfo.Quality))
|
||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.Profile, file.Quality, subject.ParsedEpisodeInfo.Quality))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user