mirror of https://github.com/Radarr/Radarr
Fixed: Adjusted BTN Recent Feed (RssSync) to better use their api db indexes.
This commit is contained in:
parent
2f3bc61af7
commit
0f1afd416b
|
@ -44,14 +44,27 @@ namespace NzbDrone.Common.Http
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
if (ContentSummary == null)
|
||||
return ToString();
|
||||
}
|
||||
|
||||
public string ToString(bool includeMethod = true, bool includeSummary = true)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
||||
if (includeMethod)
|
||||
{
|
||||
return string.Format("Req: [{0}] {1}", Method, Url);
|
||||
builder.AppendFormat("Req: [{0}] ", Method);
|
||||
}
|
||||
else
|
||||
|
||||
builder.Append(Url);
|
||||
|
||||
if (includeSummary && ContentSummary.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return string.Format("Req: [{0}] {1}: {2}", Method, Url, ContentSummary);
|
||||
builder.Append(": ");
|
||||
builder.Append(ContentSummary);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public void SetContent(byte[] data)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Common.Http
|
||||
|
@ -86,7 +87,7 @@ namespace NzbDrone.Common.Http
|
|||
else
|
||||
{
|
||||
data = value;
|
||||
summary = data.ToJson();
|
||||
summary = JsonConvert.SerializeObject(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,19 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new BroadcastheNetRequestGenerator() { Settings = Settings, PageSize = PageSize };
|
||||
var requestGenerator = new BroadcastheNetRequestGenerator() { Settings = Settings, PageSize = PageSize };
|
||||
|
||||
var releaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id);
|
||||
if (releaseInfo != null)
|
||||
{
|
||||
int torrentID;
|
||||
if (int.TryParse(releaseInfo.Guid.Replace("BTN-", string.Empty), out torrentID))
|
||||
{
|
||||
requestGenerator.LastRecentTorrentID = torrentID;
|
||||
}
|
||||
}
|
||||
|
||||
return requestGenerator;
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|||
public int PageSize { get; set; }
|
||||
public BroadcastheNetSettings Settings { get; set; }
|
||||
|
||||
public int? LastRecentTorrentID { get; set; }
|
||||
|
||||
public BroadcastheNetRequestGenerator()
|
||||
{
|
||||
MaxPages = 10;
|
||||
|
@ -23,7 +25,18 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, null));
|
||||
var parameters = new BroadcastheNetTorrentQuery();
|
||||
|
||||
if (LastRecentTorrentID.HasValue)
|
||||
{
|
||||
parameters.Id = ">=" + (LastRecentTorrentID.Value - 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters.Age = "<=86400";
|
||||
}
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
@ -167,11 +180,6 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
|||
|
||||
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, BroadcastheNetTorrentQuery parameters)
|
||||
{
|
||||
if (parameters == null)
|
||||
{
|
||||
parameters = new BroadcastheNetTorrentQuery();
|
||||
}
|
||||
|
||||
var builder = new JsonRpcRequestBuilder(Settings.BaseUrl)
|
||||
.Call("getTorrents", Settings.ApiKey, parameters, PageSize, 0);
|
||||
builder.SuppressHttpError = true;
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace NzbDrone.Core.Indexers
|
|||
|
||||
protected virtual IndexerResponse FetchIndexerResponse(IndexerRequest request)
|
||||
{
|
||||
_logger.Debug("Downloading Feed " + request.Url);
|
||||
_logger.Debug("Downloading Feed " + request.HttpRequest.ToString(false));
|
||||
|
||||
if (request.HttpRequest.RateLimit < RateLimit)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue