Fixed: Use HashSet to prevent duplicated indexer flags

pull/1299/head
Bogdan 2 years ago committed by Qstick
parent 6d87bd9f8c
commit 71dd8b6d04

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Indexers.FileList
{ {
var id = result.Id; var id = result.Id;
var flags = new List<IndexerFlag>(); var flags = new HashSet<IndexerFlag>();
if (result.Internal) if (result.Internal)
{ {

@ -55,7 +55,7 @@ namespace NzbDrone.Core.Indexers.HDBits
var id = result.Id; var id = result.Id;
var internalRelease = result.TypeOrigin == 1 ? true : false; var internalRelease = result.TypeOrigin == 1 ? true : false;
var flags = new List<IndexerFlag>(); var flags = new HashSet<IndexerFlag>();
if (internalRelease) if (internalRelease)
{ {

@ -72,7 +72,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
var id = torrent.Id; var id = torrent.Id;
var title = torrent.ReleaseName; var title = torrent.ReleaseName;
var flags = new List<IndexerFlag>(); var flags = new HashSet<IndexerFlag>();
if (torrent.GoldenPopcorn) if (torrent.GoldenPopcorn)
{ {

@ -229,15 +229,14 @@ namespace NzbDrone.Core.Indexers.Torznab
return base.GetPeers(item); return base.GetPeers(item);
} }
protected List<IndexerFlag> GetFlags(XElement item) protected HashSet<IndexerFlag> GetFlags(XElement item)
{ {
var flags = new List<IndexerFlag>(); var flags = new HashSet<IndexerFlag>();
var downloadFactor = TryGetFloatTorznabAttribute(item, "downloadvolumefactor", 1); var downloadFactor = TryGetFloatTorznabAttribute(item, "downloadvolumefactor", 1);
var uploadFactor = TryGetFloatTorznabAttribute(item, "uploadvolumefactor", 1); var uploadFactor = TryGetFloatTorznabAttribute(item, "uploadvolumefactor", 1);
if (uploadFactor == 2) if (uploadFactor == 2.0)
{ {
flags.Add(IndexerFlag.DoubleUpload); flags.Add(IndexerFlag.DoubleUpload);
} }

@ -10,7 +10,7 @@ namespace NzbDrone.Core.Parser.Model
{ {
public ReleaseInfo() public ReleaseInfo()
{ {
IndexerFlags = new List<IndexerFlag>(); IndexerFlags = new HashSet<IndexerFlag>();
Categories = new List<IndexerCategory>(); Categories = new List<IndexerCategory>();
Languages = new List<string>(); Languages = new List<string>();
Subs = new List<string>(); Subs = new List<string>();
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Parser.Model
public ICollection<string> Languages { get; set; } public ICollection<string> Languages { get; set; }
public ICollection<string> Subs { get; set; } public ICollection<string> Subs { get; set; }
public ICollection<IndexerCategory> Categories { get; set; } public ICollection<IndexerCategory> Categories { get; set; }
public ICollection<IndexerFlag> IndexerFlags { get; set; } public HashSet<IndexerFlag> IndexerFlags { get; set; }
public int Age public int Age
{ {

Loading…
Cancel
Save