NZBGet delete:scan treated as failure (#898)

Mitchell Cash 8 years ago committed by Devin Buhl
parent f9f67873ad
commit 22fcb04773

@ -17,6 +17,8 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public class Nzbget : UsenetClientBase<NzbgetSettings>
{
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<DownloadClientItem>();
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);
}

Loading…
Cancel
Save