1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 01:37:07 +00:00

Fixed: QueueSpecification failing when an unknown item is in the queue

This commit is contained in:
Mark McDowall 2019-01-17 18:47:16 -08:00
parent 4bc0ffa74d
commit ae2efbc116
2 changed files with 10 additions and 2 deletions

View file

@ -31,8 +31,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
{
var queue = _queueService.GetQueue();
var matchingSeries = queue.Where(q => q.RemoteEpisode.Series != null && q.RemoteEpisode.Series.Id == subject.Series.Id);
var matchingEpisode = matchingSeries.Where(q => q.RemoteEpisode.Episodes.Select(e => e.Id).Intersect(subject.Episodes.Select(e => e.Id)).Any());
var matchingEpisode = queue.Where(q => q.RemoteEpisode != null &&
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();
foreach (var queueItem in matchingEpisode)
{

View file

@ -16,6 +16,11 @@ namespace NzbDrone.Core.Parser.Model
public TorrentSeedConfiguration SeedConfiguration { get; set; }
public int PreferredWordScore { get; set; }
public RemoteEpisode()
{
Episodes = new List<Episode>();
}
public bool IsRecentEpisode()
{
return Episodes.Any(e => e.AirDateUtc >= DateTime.UtcNow.Date.AddDays(-14));