mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-25 09:18:34 +00:00
Fixed: QueueSpecification failing when an unknown item is in the queue
This commit is contained in:
parent
4bc0ffa74d
commit
ae2efbc116
2 changed files with 10 additions and 2 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue