Fixed detection of failed unpack for nzbget proxy.

This commit is contained in:
Taloth Saldono 2014-05-23 21:18:49 +02:00
parent 2035fe8578
commit b8c9f6d42e
2 changed files with 21 additions and 7 deletions

View File

@ -115,15 +115,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
}
var historyItems = new List<DownloadClientItem>();
var successStatues = new[] {"SUCCESS", "NONE"};
var successStatus = new[] {"SUCCESS", "NONE"};
foreach (var item in history)
{
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
var status = successStatues.Contains(item.ParStatus) &&
successStatues.Contains(item.ScriptStatus)
? DownloadItemStatus.Completed
: DownloadItemStatus.Failed;
var historyItem = new DownloadClientItem();
historyItem.DownloadClient = Definition.Name;
@ -132,8 +128,22 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo);
historyItem.OutputPath = item.DestDir;
historyItem.Category = item.Category;
historyItem.Message = String.Format("PAR Status: {0} - Script Status: {1}", item.ParStatus, item.ScriptStatus);
historyItem.Status = status;
historyItem.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);
historyItem.Status = DownloadItemStatus.Completed;
if (!successStatus.Contains(item.ParStatus) ||
!successStatus.Contains(item.UnpackStatus) ||
!successStatus.Contains(item.MoveStatus) ||
!successStatus.Contains(item.ScriptStatus) ||
!successStatus.Contains(item.DeleteStatus) ||
!successStatus.Contains(item.MarkStatus))
{
historyItem.Status = DownloadItemStatus.Failed;
}
else if (item.MoveStatus != "SUCCESS")
{
historyItem.Status = DownloadItemStatus.Queued;
}
historyItems.Add(historyItem);
}

View File

@ -11,7 +11,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public UInt32 FileSizeLo { get; set; }
public UInt32 FileSizeHi { get; set; }
public String ParStatus { get; set; }
public String UnpackStatus { get; set; }
public String MoveStatus { get; set; }
public String ScriptStatus { get; set; }
public String DeleteStatus { get; set; }
public String MarkStatus { get; set; }
public String DestDir { get; set; }
public List<NzbgetParameter> Parameters { get; set; }
}