From a7c00a0fd76ddea7a53ef48da727660fa6371e09 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 7 Nov 2023 14:48:05 +0200 Subject: [PATCH] Fixed: (Redacted) Filter old releases on RSS --- .../Indexers/Definitions/Redacted.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs index 7016d8651..d2f829732 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs @@ -29,6 +29,7 @@ namespace NzbDrone.Core.Indexers.Definitions public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); public override bool SupportsRedirect => true; + public override TimeSpan RateLimit => TimeSpan.FromSeconds(3); public Redacted(IIndexerHttpClient httpClient, IEventAggregator eventAggregator, @@ -63,10 +64,24 @@ namespace NzbDrone.Core.Indexers.Definitions return Task.FromResult(request); } + protected override IList CleanupReleases(IEnumerable releases, SearchCriteriaBase searchCriteria) + { + var cleanReleases = base.CleanupReleases(releases, searchCriteria); + + if (searchCriteria.IsRssSearch) + { + cleanReleases = cleanReleases.Take(50).ToList(); + } + + return cleanReleases; + } + private IndexerCapabilities SetCapabilities() { var caps = new IndexerCapabilities { + LimitsDefault = 50, + LimitsMax = 50, MusicSearchParams = new List { MusicSearchParam.Q, MusicSearchParam.Artist, MusicSearchParam.Album, MusicSearchParam.Year @@ -172,6 +187,7 @@ namespace NzbDrone.Core.Indexers.Definitions } var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories); + if (queryCats.Any()) { queryCats.ForEach(cat => parameters.Set($"filter_cat[{cat}]", "1"));