Fixed: Filter old releases on RSS for RED and Gazelle

pull/4288/head
Bogdan 1 year ago
parent 8a31a18a99
commit 7669563518

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FluentValidation.Results;
using NLog;
@ -6,6 +8,7 @@ using NzbDrone.Common.Cache;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Core.Indexers.Gazelle
@ -17,6 +20,7 @@ namespace NzbDrone.Core.Indexers.Gazelle
public override bool SupportsRss => true;
public override bool SupportsSearch => true;
public override int PageSize => 50;
public override TimeSpan RateLimit => TimeSpan.FromSeconds(3);
private readonly ICached<Dictionary<string, string>> _authCookieCache;
@ -33,7 +37,7 @@ namespace NzbDrone.Core.Indexers.Gazelle
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new GazelleRequestGenerator()
return new GazelleRequestGenerator
{
Settings = Settings,
HttpClient = _httpClient,
@ -47,6 +51,18 @@ namespace NzbDrone.Core.Indexers.Gazelle
return new GazelleParser(Settings);
}
protected override IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> releases, bool isRecent = false)
{
var cleanReleases = base.CleanupReleases(releases, isRecent);
if (isRecent)
{
cleanReleases = cleanReleases.Take(50).ToList();
}
return cleanReleases;
}
public override IEnumerable<ProviderDefinition> DefaultDefinitions
{
get

@ -252,7 +252,7 @@ namespace NzbDrone.Core.Indexers
_logger.Error(ex, "An error occurred while processing feed. {0}", url);
}
return CleanupReleases(releases);
return CleanupReleases(releases, isRecent);
}
protected virtual bool IsValidRelease(ReleaseInfo release)

@ -72,7 +72,7 @@ namespace NzbDrone.Core.Indexers
public abstract Task<IList<ReleaseInfo>> Fetch(ArtistSearchCriteria searchCriteria);
public abstract HttpRequest GetDownloadRequest(string link);
protected virtual IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> releases)
protected virtual IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> releases, bool isRecent = false)
{
var result = releases.DistinctBy(v => v.Guid).ToList();

@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Indexers.Redacted
{
@ -12,6 +16,7 @@ namespace NzbDrone.Core.Indexers.Redacted
public override bool SupportsRss => true;
public override bool SupportsSearch => true;
public override int PageSize => 50;
public override TimeSpan RateLimit => TimeSpan.FromSeconds(3);
public Redacted(IHttpClient httpClient,
IIndexerStatusService indexerStatusService,
@ -39,5 +44,17 @@ namespace NzbDrone.Core.Indexers.Redacted
return request;
}
protected override IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> releases, bool isRecent = false)
{
var cleanReleases = base.CleanupReleases(releases, isRecent);
if (isRecent)
{
cleanReleases = cleanReleases.Take(50).ToList();
}
return cleanReleases;
}
}
}

Loading…
Cancel
Save