From 22fcb047738135e61ed466e92cc3d7491eb13d0a Mon Sep 17 00:00:00 2001 From: Mitchell Cash Date: Sun, 26 Feb 2017 14:22:25 +1000 Subject: [PATCH] NZBGet delete:scan treated as failure (#898) --- .../Download/Clients/Nzbget/Nzbget.cs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index fd9ba654e..f039350d1 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -17,6 +17,8 @@ namespace NzbDrone.Core.Download.Clients.Nzbget public class Nzbget : UsenetClientBase { private readonly INzbgetProxy _proxy; + private readonly string[] _successStatus = { "SUCCESS", "NONE" }; + private readonly string[] _deleteFailedStatus = { "HEALTH", "DUPE", "SCAN", "COPY" }; public Nzbget(INzbgetProxy proxy, IHttpClient httpClient, @@ -134,7 +136,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget } var historyItems = new List(); - var successStatus = new[] { "SUCCESS", "NONE" }; foreach (var item in history) { @@ -148,7 +149,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo), OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(item.DestDir)), Category = item.Category, - Message = string.Format("PAR Status: {0} - Unpack Status: {1} - Move Status: {2} - Script Status: {3} - Delete Status: {4} - Mark Status: {5}", item.ParStatus, item.UnpackStatus, item.MoveStatus, item.ScriptStatus, item.DeleteStatus, item.MarkStatus), + Message = $"PAR Status: {item.ParStatus} - Unpack Status: {item.UnpackStatus} - Move Status: {item.MoveStatus} - Script Status: {item.ScriptStatus} - Delete Status: {item.DeleteStatus} - Mark Status: {item.MarkStatus}", Status = DownloadItemStatus.Completed, RemainingTime = TimeSpan.Zero }; @@ -157,7 +158,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget continue; } - if (!successStatus.Contains(item.ParStatus)) + if (!_successStatus.Contains(item.ParStatus)) { historyItem.Status = DownloadItemStatus.Failed; } @@ -166,24 +167,24 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { historyItem.Status = DownloadItemStatus.Warning; } - else if (!successStatus.Contains(item.UnpackStatus)) + else if (!_successStatus.Contains(item.UnpackStatus)) { historyItem.Status = DownloadItemStatus.Failed; } - if (!successStatus.Contains(item.MoveStatus)) + if (!_successStatus.Contains(item.MoveStatus)) { historyItem.Status = DownloadItemStatus.Warning; } - if (!successStatus.Contains(item.ScriptStatus)) + if (!_successStatus.Contains(item.ScriptStatus)) { historyItem.Status = DownloadItemStatus.Failed; } - if (!successStatus.Contains(item.DeleteStatus) && item.DeleteStatus.IsNotNullOrWhiteSpace()) + if (!_successStatus.Contains(item.DeleteStatus) && item.DeleteStatus.IsNotNullOrWhiteSpace()) { - if (item.DeleteStatus == "COPY" || item.DeleteStatus == "DUPE") + if (_deleteFailedStatus.Contains(item.DeleteStatus)) { historyItem.Status = DownloadItemStatus.Failed; } @@ -193,11 +194,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget } } - if (item.DeleteStatus == "HEALTH") - { - historyItem.Status = DownloadItemStatus.Failed; - } - historyItems.Add(historyItem); }