mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-26 06:40:53 +02:00
Fixed: (IPTorrents) Fix pagination when limit is zero
This commit is contained in:
parent
2cebdf4a06
commit
8917347c0b
1 changed files with 23 additions and 24 deletions
|
|
@ -20,7 +20,7 @@ public class IPTorrents : TorrentIndexerBase<IPTorrentsSettings>
|
|||
{
|
||||
public override string Name => "IPTorrents";
|
||||
|
||||
public override string[] IndexerUrls => new string[]
|
||||
public override string[] IndexerUrls => new[]
|
||||
{
|
||||
"https://iptorrents.com/",
|
||||
"https://iptorrents.me/",
|
||||
|
|
@ -46,7 +46,7 @@ public IPTorrents(IIndexerHttpClient httpClient, IEventAggregator eventAggregato
|
|||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new IPTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities };
|
||||
return new IPTorrentsRequestGenerator { Settings = Settings, Capabilities = Capabilities };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
|
|
@ -64,21 +64,21 @@ private IndexerCapabilities SetCapabilities()
|
|||
var caps = new IndexerCapabilities
|
||||
{
|
||||
TvSearchParams = new List<TvSearchParam>
|
||||
{
|
||||
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId
|
||||
},
|
||||
{
|
||||
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId
|
||||
},
|
||||
MovieSearchParams = new List<MovieSearchParam>
|
||||
{
|
||||
MovieSearchParam.Q, MovieSearchParam.ImdbId
|
||||
},
|
||||
{
|
||||
MovieSearchParam.Q, MovieSearchParam.ImdbId
|
||||
},
|
||||
MusicSearchParams = new List<MusicSearchParam>
|
||||
{
|
||||
MusicSearchParam.Q
|
||||
},
|
||||
{
|
||||
MusicSearchParam.Q
|
||||
},
|
||||
BookSearchParams = new List<BookSearchParam>
|
||||
{
|
||||
BookSearchParam.Q
|
||||
}
|
||||
{
|
||||
BookSearchParam.Q
|
||||
}
|
||||
};
|
||||
|
||||
caps.Categories.AddCategoryMapping(72, NewznabStandardCategory.Movies, "Movies");
|
||||
|
|
@ -161,10 +161,6 @@ public class IPTorrentsRequestGenerator : IIndexerRequestGenerator
|
|||
public IPTorrentsSettings Settings { get; set; }
|
||||
public IndexerCapabilities Capabilities { get; set; }
|
||||
|
||||
public IPTorrentsRequestGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, int limit, int offset, string imdbId = null)
|
||||
{
|
||||
var searchUrl = Settings.BaseUrl + "t";
|
||||
|
|
@ -194,9 +190,16 @@ private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categori
|
|||
qc.Add(cat, string.Empty);
|
||||
}
|
||||
|
||||
qc.Add("p", ((offset / limit) + 1).ToString());
|
||||
if (offset > 0 && limit > 0)
|
||||
{
|
||||
var page = (int)(offset / limit) + 1;
|
||||
qc.Add("p", page.ToString());
|
||||
}
|
||||
|
||||
searchUrl = searchUrl + "?" + qc.GetQueryString();
|
||||
if (qc.Count > 0)
|
||||
{
|
||||
searchUrl += $"?{qc.GetQueryString()}";
|
||||
}
|
||||
|
||||
var request = new IndexerRequest(searchUrl, HttpAccept.Html);
|
||||
|
||||
|
|
@ -356,10 +359,6 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
|
||||
public class IPTorrentsSettings : CookieTorrentBaseSettings
|
||||
{
|
||||
public IPTorrentsSettings()
|
||||
{
|
||||
}
|
||||
|
||||
[FieldDefinition(2, Label = "Cookie User-Agent", Type = FieldType.Textbox, HelpText = "User-Agent associated with cookie used from Browser")]
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue