From b62d36bdbed5614e82b9884411ab26d31ae4fd09 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 11 Apr 2015 09:03:35 +0200 Subject: [PATCH] Fixed: If Nzbget failed to add an nzb, Sonarr will try another but not blacklist it. --- .../DownloadClientTests/NzbgetTests/NzbgetFixture.cs | 12 +++++++++++- src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs index 7936a532e..043db1513 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs @@ -9,6 +9,7 @@ using NzbDrone.Core.Download.Clients.Nzbget; using NzbDrone.Test.Common; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Common.Disk; +using NzbDrone.Core.Download.Clients; namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests { @@ -268,7 +269,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests items.First().Status.Should().Be(DownloadItemStatus.Failed); } - [Test] public void Download_should_return_unique_id() { @@ -281,6 +281,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests id.Should().NotBeNullOrEmpty(); } + [Test] + public void Download_should_throw_if_failed() + { + GivenFailedDownload(); + + var remoteEpisode = CreateRemoteEpisode(); + + Assert.Throws(() => Subject.Download(remoteEpisode)); + } + [Test] public void GetItems_should_ignore_downloads_from_other_categories() { diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index 3730c7567..7f54492f6 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -36,6 +36,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings); + if (response == null) + { + throw new DownloadClientException("Failed to add nzb {0}", filename); + } + return response; } @@ -43,7 +48,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { NzbgetGlobalStatus globalStatus; List queue; - Dictionary postQueue; try {