Fixed: Only show best pending item in Queue
This commit is contained in:
parent
dc2c1f7928
commit
74ad841be4
|
@ -134,7 +134,17 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return queued;
|
//Return best quality release for each episode
|
||||||
|
var deduped = queued.GroupBy(q => q.Episode.Id).Select(g =>
|
||||||
|
{
|
||||||
|
var series = g.First().Series;
|
||||||
|
|
||||||
|
return g.OrderByDescending(e => e.Quality, new QualityModelComparer(series.Profile))
|
||||||
|
.ThenBy(q => PrioritizeDownloadProtocol(q.Series, q.Protocol))
|
||||||
|
.First();
|
||||||
|
});
|
||||||
|
|
||||||
|
return deduped.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Queue.Queue FindPendingQueueItem(int queueId)
|
public Queue.Queue FindPendingQueueItem(int queueId)
|
||||||
|
@ -288,6 +298,18 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
return HashConverter.GetHashInt31(String.Format("pending-{0}-ep{1}", pendingRelease.Id, episode.Id));
|
return HashConverter.GetHashInt31(String.Format("pending-{0}-ep{1}", pendingRelease.Id, episode.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int PrioritizeDownloadProtocol(Series series, DownloadProtocol downloadProtocol)
|
||||||
|
{
|
||||||
|
var delayProfile = _delayProfileService.BestForTags(series.Tags);
|
||||||
|
|
||||||
|
if (downloadProtocol == delayProfile.PreferredProtocol)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
public void Handle(SeriesDeletedEvent message)
|
public void Handle(SeriesDeletedEvent message)
|
||||||
{
|
{
|
||||||
_repository.DeleteBySeriesId(message.Series.Id);
|
_repository.DeleteBySeriesId(message.Series.Id);
|
||||||
|
|
Loading…
Reference in New Issue