mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-23 22:17:15 -04:00
New: Use Best PageSize for Newznab/Torznab
Max of Default or Max and no more than 100
This commit is contained in:
parent
c6e91e028b
commit
c222a1a434
4 changed files with 24 additions and 7 deletions
|
@ -62,13 +62,21 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||
releaseInfo.Size.Should().Be(1183105773);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_pagesize_reported_by_caps()
|
||||
public void should_use_best_pagesize_reported_by_caps()
|
||||
{
|
||||
_caps.MaxPageSize = 30;
|
||||
_caps.DefaultPageSize = 25;
|
||||
|
||||
Subject.PageSize.Should().Be(25);
|
||||
Subject.PageSize.Should().Be(30);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_pagesize_over_100_even_if_reported_in_caps()
|
||||
{
|
||||
_caps.MaxPageSize = 250;
|
||||
_caps.DefaultPageSize = 25;
|
||||
|
||||
Subject.PageSize.Should().Be(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,12 +135,21 @@ namespace NzbDrone.Core.Test.IndexerTests.TorznabTests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_pagesize_reported_by_caps()
|
||||
public void should_use_best_pagesize_reported_by_caps()
|
||||
{
|
||||
_caps.MaxPageSize = 30;
|
||||
_caps.DefaultPageSize = 25;
|
||||
|
||||
Subject.PageSize.Should().Be(25);
|
||||
Subject.PageSize.Should().Be(30);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_pagesize_over_100_even_if_reported_in_caps()
|
||||
{
|
||||
_caps.MaxPageSize = 250;
|
||||
_caps.DefaultPageSize = 25;
|
||||
|
||||
Subject.PageSize.Should().Be(100);
|
||||
}
|
||||
|
||||
[TestCase("http://localhost:9117/", "/api")]
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Usenet;
|
||||
|
||||
public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize;
|
||||
public override int PageSize => Math.Min(100, Math.Max(_capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize, _capabilitiesProvider.GetCapabilities(Settings).MaxPageSize));
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
|||
public override string Name => "Torznab";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize;
|
||||
public override int PageSize => Math.Min(100, Math.Max(_capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize, _capabilitiesProvider.GetCapabilities(Settings).MaxPageSize));
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue