mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-19 17:32:38 +01: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
@ -62,13 +62,21 @@ public void should_parse_recent_feed_from_newznab_nzb_su()
|
||||
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 @@ public void should_parse_recent_feed_from_torznab_animetosho()
|
||||
}
|
||||
|
||||
[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 @@ public class Newznab : HttpIndexerBase<NewznabSettings>
|
||||
|
||||
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 @@ public class Torznab : HttpIndexerBase<TorznabSettings>
|
||||
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…
Reference in New Issue
Block a user