mirror of https://github.com/lidarr/Lidarr
New: Use better page size for Newznab/Torznab (up to 100) when supported by the indexer
Closes #3340 (cherry picked from commit ddb25b109575cc378462a1c3a64705f2003f01f0)
This commit is contained in:
parent
fc79738fcb
commit
16f30e7f19
|
@ -65,12 +65,21 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_use_pagesize_reported_by_caps()
|
public void should_use_best_pagesize_reported_by_caps()
|
||||||
{
|
{
|
||||||
_caps.MaxPageSize = 30;
|
_caps.MaxPageSize = 30;
|
||||||
_caps.DefaultPageSize = 25;
|
_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -103,12 +103,21 @@ namespace NzbDrone.Core.Test.IndexerTests.TorznabTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_use_pagesize_reported_by_caps()
|
public void should_use_best_pagesize_reported_by_caps()
|
||||||
{
|
{
|
||||||
_caps.MaxPageSize = 30;
|
_caps.MaxPageSize = 30;
|
||||||
_caps.DefaultPageSize = 25;
|
_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")]
|
[TestCase("http://localhost:9117/", "/api")]
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
|
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Usenet;
|
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()
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||||
public override string Name => "Torznab";
|
public override string Name => "Torznab";
|
||||||
|
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
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()
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue