diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs index e036cbf06..1934f73a8 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs @@ -15,12 +15,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications private readonly Logger _logger; public QueueSpecification(IQueueService queueService, - UpgradableSpecification UpgradableSpecification, + UpgradableSpecification upgradableSpecification, IPreferredWordService preferredWordServiceCalculator, Logger logger) { _queueService = queueService; - _upgradableSpecification = UpgradableSpecification; + _upgradableSpecification = upgradableSpecification; _preferredWordServiceCalculator = preferredWordServiceCalculator; _logger = logger; } @@ -31,8 +31,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications public Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria) { var queue = _queueService.GetQueue(); - var matchingEpisode = queue.Where(q => q.RemoteEpisode != null && - q.RemoteEpisode.Series != null && + var matchingEpisode = queue.Where(q => q.RemoteEpisode?.Series != null && q.RemoteEpisode.Series.Id == subject.Series.Id && q.RemoteEpisode.Episodes.Select(e => e.Id).Intersect(subject.Episodes.Select(e => e.Id)).Any()) .ToList(); diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs index 9b3129d36..0567984f6 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/HistorySpecification.cs @@ -53,6 +53,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync { var recent = mostRecent.Date.After(DateTime.UtcNow.AddHours(-12)); + if (!recent && cdhEnabled) + { + continue; + } + // The series will be the same as the one in history since it's the same episode. // Instead of fetching the series from the DB reuse the known series. var preferredWordScore = _preferredWordServiceCalculator.Calculate(subject.Series, mostRecent.SourceTitle); @@ -76,11 +81,6 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync subject.ParsedEpisodeInfo.Language, subject.PreferredWordScore); - if (!recent && cdhEnabled) - { - continue; - } - if (!cutoffUnmet) { if (recent) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs index a031edd4a..0a638c3b3 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications return Decision.Reject("Not an upgrade for existing episode file(s)"); } - if (languageComparer.Compare(localEpisode.Language, episodeFile.Language) < 0 && qualityCompare == 0) + if (languageComparer.Compare(localEpisode.Language, episodeFile.Language) < 0 && qualityCompare == 0) { _logger.Debug("This file isn't a language upgrade for all episodes. Skipping {0}", localEpisode.Path); return Decision.Reject("Not an upgrade for existing episode file(s)");