mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 13:34:54 +00:00
Fix downloading releases without an indexer
(cherry picked from commit ca8b26138e3ebd793cc1a5fd51522ce3eda8a2e1) Closes #3598
This commit is contained in:
parent
8a685be882
commit
a7e4a85cef
3 changed files with 9 additions and 3 deletions
|
@ -63,7 +63,6 @@ public void DownloadReport(RemoteAlbum remoteAlbum)
|
||||||
|
|
||||||
// Get the seed configuration for this release.
|
// Get the seed configuration for this release.
|
||||||
remoteAlbum.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteAlbum);
|
remoteAlbum.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteAlbum);
|
||||||
var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteAlbum.Release.IndexerId));
|
|
||||||
|
|
||||||
// Limit grabs to 2 per second.
|
// Limit grabs to 2 per second.
|
||||||
if (remoteAlbum.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteAlbum.Release.DownloadUrl.StartsWith("magnet:"))
|
if (remoteAlbum.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteAlbum.Release.DownloadUrl.StartsWith("magnet:"))
|
||||||
|
@ -72,6 +71,13 @@ public void DownloadReport(RemoteAlbum remoteAlbum)
|
||||||
_rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2));
|
_rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IIndexer indexer = null;
|
||||||
|
|
||||||
|
if (remoteAlbum.Release.IndexerId > 0)
|
||||||
|
{
|
||||||
|
indexer = _indexerFactory.GetInstance(_indexerFactory.Get(remoteAlbum.Release.IndexerId));
|
||||||
|
}
|
||||||
|
|
||||||
string downloadClientId;
|
string downloadClientId;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,7 +127,7 @@ private string DownloadFromWebUrl(RemoteAlbum remoteAlbum, IIndexer indexer, str
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = indexer.GetDownloadRequest(torrentUrl);
|
var request = indexer?.GetDownloadRequest(torrentUrl) ?? new HttpRequest(torrentUrl);
|
||||||
request.RateLimitKey = remoteAlbum?.Release?.IndexerId.ToString();
|
request.RateLimitKey = remoteAlbum?.Release?.IndexerId.ToString();
|
||||||
request.Headers.Accept = "application/x-bittorrent";
|
request.Headers.Accept = "application/x-bittorrent";
|
||||||
request.AllowAutoRedirect = false;
|
request.AllowAutoRedirect = false;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public override string Download(RemoteAlbum remoteAlbum, IIndexer indexer)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = indexer.GetDownloadRequest(url);
|
var request = indexer?.GetDownloadRequest(url) ?? new HttpRequest(url);
|
||||||
request.RateLimitKey = remoteAlbum?.Release?.IndexerId.ToString();
|
request.RateLimitKey = remoteAlbum?.Release?.IndexerId.ToString();
|
||||||
|
|
||||||
// TODO: Look into moving download request handling to indexer
|
// TODO: Look into moving download request handling to indexer
|
||||||
|
|
Loading…
Reference in a new issue