From f16f097b3e992050668576a571c3ab4ad6e2a81b Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 23 Apr 2016 10:12:49 +0200 Subject: [PATCH] Fixed: Sabnzbd 1.0.1 added two new status values. fixes #1259 --- .../SabnzbdTests/SabnzbdFixture.cs | 23 +++++++++++++++++++ .../Download/Clients/Sabnzbd/Sabnzbd.cs | 10 ++++++++ .../Clients/Sabnzbd/SabnzbdDownloadStatus.cs | 4 +++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs index a6fe80687..bf8faf979 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs @@ -188,6 +188,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests [TestCase(SabnzbdDownloadStatus.Checking)] [TestCase(SabnzbdDownloadStatus.Downloading)] [TestCase(SabnzbdDownloadStatus.QuickCheck)] + [TestCase(SabnzbdDownloadStatus.ToPP)] [TestCase(SabnzbdDownloadStatus.Verifying)] [TestCase(SabnzbdDownloadStatus.Repairing)] [TestCase(SabnzbdDownloadStatus.Fetching)] @@ -231,6 +232,28 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests VerifyFailed(result); } + [Test] + public void deleted_queue_item_should_be_ignored() + { + _queued.Items.First().Status = SabnzbdDownloadStatus.Deleted; + + GivenQueue(_queued); + GivenHistory(null); + + Subject.GetItems().Should().BeEmpty(); + } + + [Test] + public void deleted_history_item_should_be_ignored() + { + _completed.Items.First().Status = SabnzbdDownloadStatus.Deleted; + + GivenQueue(null); + GivenHistory(_completed); + + Subject.GetItems().Should().BeEmpty(); + } + [TestCase("[ TOWN ]-[ http://www.town.ag ]-[ ANIME ]-[Usenet Provider >> http://www.ssl- <<] - [Commie] Aldnoah Zero 18 [234C8FC7]", "[ TOWN ]-[ http-++www.town.ag ]-[ ANIME ]-[Usenet Provider http-++www.ssl- ] - [Commie] Aldnoah Zero 18 [234C8FC7].nzb")] public void Download_should_use_clean_title(string title, string filename) { diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index 8632de04e..57b20dbe2 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -65,6 +65,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd foreach (var sabQueueItem in sabQueue.Items) { + if (sabQueueItem.Status == SabnzbdDownloadStatus.Deleted) + { + continue; + } + var queueItem = new DownloadClientItem(); queueItem.DownloadClient = Definition.Name; queueItem.DownloadId = sabQueueItem.Id; @@ -119,6 +124,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd foreach (var sabHistoryItem in sabHistory.Items) { + if (sabHistoryItem.Status == SabnzbdDownloadStatus.Deleted) + { + continue; + } + var historyItem = new DownloadClientItem { DownloadClient = Definition.Name, diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdDownloadStatus.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdDownloadStatus.cs index 6ca60a9cd..948de9bc8 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdDownloadStatus.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdDownloadStatus.cs @@ -7,6 +7,7 @@ Paused, Checking, Downloading, + ToPP, QuickCheck, Verifying, Repairing, @@ -15,6 +16,7 @@ Moving, Running, // Running PP Script Completed, - Failed + Failed, + Deleted } }