mirror of https://github.com/Sonarr/Sonarr
Fix downloading releases without an indexer
This commit is contained in:
parent
b0773ae7e3
commit
ca8b26138e
|
@ -71,7 +71,6 @@ namespace NzbDrone.Core.Download
|
|||
|
||||
// Get the seed configuration for this release.
|
||||
remoteEpisode.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteEpisode);
|
||||
var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteEpisode.Release.IndexerId));
|
||||
|
||||
// Limit grabs to 2 per second.
|
||||
if (remoteEpisode.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteEpisode.Release.DownloadUrl.StartsWith("magnet:"))
|
||||
|
@ -80,6 +79,13 @@ namespace NzbDrone.Core.Download
|
|||
_rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2));
|
||||
}
|
||||
|
||||
IIndexer indexer = null;
|
||||
|
||||
if (remoteEpisode.Release.IndexerId > 0)
|
||||
{
|
||||
indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteEpisode.Release.IndexerId));
|
||||
}
|
||||
|
||||
string downloadClientId;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace NzbDrone.Core.Download
|
|||
|
||||
try
|
||||
{
|
||||
var request = indexer.GetDownloadRequest(torrentUrl);
|
||||
var request = indexer?.GetDownloadRequest(torrentUrl) ?? new HttpRequest(torrentUrl);
|
||||
request.RateLimitKey = remoteEpisode?.Release?.IndexerId.ToString();
|
||||
request.Headers.Accept = "application/x-bittorrent";
|
||||
request.AllowAutoRedirect = false;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Download
|
|||
|
||||
try
|
||||
{
|
||||
var request = indexer.GetDownloadRequest(url);
|
||||
var request = indexer?.GetDownloadRequest(url) ?? new HttpRequest(url);
|
||||
request.RateLimitKey = remoteEpisode?.Release?.IndexerId.ToString();
|
||||
nzbData = _httpClient.Get(request).ResponseData;
|
||||
|
||||
|
|
Loading…
Reference in New Issue