mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-19 07:52:33 +02:00
Use BuildInfo.AppName for RARBG appId instead of hardcoded value
(cherry picked from commit 99c4f5b746bff6809c988f8b816e5135f5959ed7) Closes #8387
This commit is contained in:
parent
2ac72d1588
commit
d4a347b2ba
@ -5,6 +5,7 @@
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Rarbg;
|
using NzbDrone.Core.Indexers.Rarbg;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
@ -47,7 +48,7 @@ public override object RequestAction(string action, IDictionary<string, string>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = new HttpRequestBuilder(Settings.BaseUrl.Trim('/'))
|
var request = new HttpRequestBuilder(Settings.BaseUrl.Trim('/'))
|
||||||
.Resource("/pubapi_v2.php?get_token=get_token")
|
.Resource($"/pubapi_v2.php?get_token=get_token&app_id={BuildInfo.AppName}")
|
||||||
.Accept(HttpAccept.Json)
|
.Accept(HttpAccept.Json)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
@ -66,7 +67,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||||||
torrentInfo.Title = torrent.title;
|
torrentInfo.Title = torrent.title;
|
||||||
torrentInfo.Size = torrent.size;
|
torrentInfo.Size = torrent.size;
|
||||||
torrentInfo.DownloadUrl = torrent.download;
|
torrentInfo.DownloadUrl = torrent.download;
|
||||||
torrentInfo.InfoUrl = torrent.info_page + "&app_id=Radarr";
|
torrentInfo.InfoUrl = $"{torrent.info_page}&app_id={BuildInfo.AppName}";
|
||||||
torrentInfo.PublishDate = torrent.pubdate.ToUniversalTime();
|
torrentInfo.PublishDate = torrent.pubdate.ToUniversalTime();
|
||||||
torrentInfo.Seeders = torrent.seeders;
|
torrentInfo.Seeders = torrent.seeders;
|
||||||
torrentInfo.Peers = torrent.leechers + torrent.seeders;
|
torrentInfo.Peers = torrent.leechers + torrent.seeders;
|
||||||
|
@ -71,7 +71,7 @@ private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? imdbId, s
|
|||||||
requestBuilder.AddQueryParam("limit", "100");
|
requestBuilder.AddQueryParam("limit", "100");
|
||||||
requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings));
|
requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings));
|
||||||
requestBuilder.AddQueryParam("format", "json_extended");
|
requestBuilder.AddQueryParam("format", "json_extended");
|
||||||
requestBuilder.AddQueryParam("app_id", "Radarr");
|
requestBuilder.AddQueryParam("app_id", BuildInfo.AppName);
|
||||||
|
|
||||||
yield return new IndexerRequest(requestBuilder.Build());
|
yield return new IndexerRequest(requestBuilder.Build());
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Cache;
|
using NzbDrone.Common.Cache;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ public string GetToken(RarbgSettings settings)
|
|||||||
{
|
{
|
||||||
var requestBuilder = new HttpRequestBuilder(settings.BaseUrl.Trim('/'))
|
var requestBuilder = new HttpRequestBuilder(settings.BaseUrl.Trim('/'))
|
||||||
.WithRateLimit(3.0)
|
.WithRateLimit(3.0)
|
||||||
.Resource("/pubapi_v2.php?get_token=get_token&app_id=Radarr")
|
.Resource($"/pubapi_v2.php?get_token=get_token&app_id={BuildInfo.AppName}")
|
||||||
.Accept(HttpAccept.Json);
|
.Accept(HttpAccept.Json);
|
||||||
|
|
||||||
if (settings.CaptchaToken.IsNotNullOrWhiteSpace())
|
if (settings.CaptchaToken.IsNotNullOrWhiteSpace())
|
||||||
@ -44,8 +45,7 @@ public string GetToken(RarbgSettings settings)
|
|||||||
var response = _httpClient.Get<JObject>(requestBuilder.Build());
|
var response = _httpClient.Get<JObject>(requestBuilder.Build());
|
||||||
|
|
||||||
return response.Resource["token"].ToString();
|
return response.Resource["token"].ToString();
|
||||||
},
|
}, TimeSpan.FromMinutes(14.0));
|
||||||
TimeSpan.FromMinutes(14.0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user