From a3873634b02c5ac28be851608c59c3b7c2c05772 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 15 Mar 2015 01:49:11 +0100 Subject: [PATCH] Fixed TorrentBlackhole failing fatally on magnet link instead of falling back to torrent url. --- src/NzbDrone.Common/Http/HttpClient.cs | 2 +- src/NzbDrone.Core/Download/TorrentClientBase.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common/Http/HttpClient.cs b/src/NzbDrone.Common/Http/HttpClient.cs index 03f9d92d2..8b5c42edd 100644 --- a/src/NzbDrone.Common/Http/HttpClient.cs +++ b/src/NzbDrone.Common/Http/HttpClient.cs @@ -115,7 +115,7 @@ public HttpResponse Execute(HttpRequest request) response.StatusCode == HttpStatusCode.MovedPermanently || response.StatusCode == HttpStatusCode.Found)) { - throw new Exception("Server requested a redirect to [" + response.Headers["Location"] + "]. Update the request URL to avoid this redirect."); + _logger.Error("Server requested a redirect to [" + response.Headers["Location"] + "]. Update the request URL to avoid this redirect."); } if (!request.SuppressHttpError && response.HasHttpError) diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index 582f2e911..bdce27d91 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -70,7 +70,14 @@ public override String Download(RemoteEpisode remoteEpisode) if (magnetUrl.IsNotNullOrWhiteSpace()) { - hash = DownloadFromMagnetUrl(remoteEpisode, magnetUrl); + try + { + hash = DownloadFromMagnetUrl(remoteEpisode, magnetUrl); + } + catch (NotSupportedException ex) + { + _logger.Debug("Magnet not supported by download client, trying torrent. ({0})", ex.Message); + } } if (hash == null && !torrentUrl.IsNullOrWhiteSpace())