mirror of
https://github.com/Readarr/Readarr
synced 2026-01-08 16:43:34 +01:00
Dedupe releases based on indexer priority
(cherry picked from commit 38c717bcef6fa5fcd2ff1c7901639eb888a94a8a) Closes #2727
This commit is contained in:
parent
9fccca1154
commit
39778a95bf
2 changed files with 12 additions and 3 deletions
|
|
@ -165,8 +165,10 @@ private List<DownloadDecision> Dispatch(Func<IIndexer, IEnumerable<ReleaseInfo>>
|
|||
|
||||
private List<DownloadDecision> DeDupeDecisions(List<DownloadDecision> decisions)
|
||||
{
|
||||
// De-dupe reports by guid so duplicate results aren't returned. Pick the one with the least rejections.
|
||||
return decisions.GroupBy(d => d.RemoteBook.Release.Guid).Select(d => d.OrderBy(v => v.Rejections.Count()).First()).ToList();
|
||||
// De-dupe reports by guid so duplicate results aren't returned. Pick the one with the least rejections and higher indexer priority.
|
||||
return decisions.GroupBy(d => d.RemoteBook.Release.Guid)
|
||||
.Select(d => d.OrderBy(v => v.Rejections.Count()).ThenBy(v => v.RemoteBook?.Release?.IndexerPriority ?? IndexerDefinition.DefaultPriority).First())
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@ namespace NzbDrone.Core.Indexers
|
|||
{
|
||||
public class IndexerDefinition : ProviderDefinition
|
||||
{
|
||||
public const int DefaultPriority = 25;
|
||||
|
||||
public IndexerDefinition()
|
||||
{
|
||||
Priority = DefaultPriority;
|
||||
}
|
||||
|
||||
public bool EnableRss { get; set; }
|
||||
public bool EnableAutomaticSearch { get; set; }
|
||||
public bool EnableInteractiveSearch { get; set; }
|
||||
|
|
@ -11,7 +18,7 @@ public class IndexerDefinition : ProviderDefinition
|
|||
public DownloadProtocol Protocol { get; set; }
|
||||
public bool SupportsRss { get; set; }
|
||||
public bool SupportsSearch { get; set; }
|
||||
public int Priority { get; set; } = 25;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public override bool Enable => EnableRss || EnableAutomaticSearch || EnableInteractiveSearch;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue