Fixed: NzbGet history items deleted due to health are now properly recognized as failed.

This commit is contained in:
Taloth Saldono 2014-09-18 23:00:52 +02:00
parent 6a30b13343
commit 8bef19448f
10 changed files with 79 additions and 14 deletions

View File

@ -209,6 +209,33 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
VerifyFailed(result); VerifyFailed(result);
} }
[Test]
public void should_report_health_deletestatus_as_failed()
{
_completed.DeleteStatus = "HEALTH";
GivenQueue(null);
GivenHistory(_completed);
var result = Subject.GetItems().Single();
result.Status.Should().Be(DownloadItemStatus.Failed);
}
[Test]
public void should_report_script_error_as_warning()
{
_completed.ScriptStatus = "FAILED";
GivenQueue(null);
GivenHistory(_completed);
var items = Subject.GetItems();
items.First().Status.Should().Be(DownloadItemStatus.Warning);
}
[Test] [Test]
public void Download_should_return_unique_id() public void Download_should_return_unique_id()
{ {

View File

@ -259,6 +259,20 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
items.Should().BeEmpty(); items.Should().BeEmpty();
} }
[Test]
public void should_report_diskspace_unpack_error_as_warning()
{
_completed.Items.First().FailMessage = "Unpacking failed, write error or disk is full?";
_completed.Items.First().Status = SabnzbdDownloadStatus.Failed;
GivenQueue(null);
GivenHistory(_completed);
var items = Subject.GetItems();
items.First().Status.Should().Be(DownloadItemStatus.Warning);
}
[Test] [Test]
public void Download_should_use_sabRecentTvPriority_when_recentEpisode_is_true() public void Download_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
{ {

View File

@ -160,8 +160,17 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
if (!successStatus.Contains(item.ParStatus) || if (!successStatus.Contains(item.ParStatus) ||
!successStatus.Contains(item.UnpackStatus) || !successStatus.Contains(item.UnpackStatus) ||
!successStatus.Contains(item.MoveStatus) || !successStatus.Contains(item.MoveStatus))
!successStatus.Contains(item.ScriptStatus)) {
historyItem.Status = DownloadItemStatus.Failed;
}
if (!successStatus.Contains(item.ScriptStatus))
{
historyItem.Status = DownloadItemStatus.Warning;
}
if (!successStatus.Contains(item.DeleteStatus))
{ {
historyItem.Status = DownloadItemStatus.Failed; historyItem.Status = DownloadItemStatus.Failed;
} }

View File

@ -137,9 +137,17 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
}; };
if (sabHistoryItem.Status == SabnzbdDownloadStatus.Failed) if (sabHistoryItem.Status == SabnzbdDownloadStatus.Failed)
{
if (sabHistoryItem.FailMessage.IsNotNullOrWhiteSpace() &&
sabHistoryItem.FailMessage.Equals("Unpacking failed, write error or disk is full?", StringComparison.InvariantCultureIgnoreCase))
{
historyItem.Status = DownloadItemStatus.Warning;
}
else
{ {
historyItem.Status = DownloadItemStatus.Failed; historyItem.Status = DownloadItemStatus.Failed;
} }
}
else if (sabHistoryItem.Status == SabnzbdDownloadStatus.Completed) else if (sabHistoryItem.Status == SabnzbdDownloadStatus.Completed)
{ {
historyItem.Status = DownloadItemStatus.Completed; historyItem.Status = DownloadItemStatus.Completed;

View File

@ -11,6 +11,7 @@ namespace NzbDrone.Core.Download
Paused = 1, Paused = 1,
Downloading = 2, Downloading = 2,
Completed = 3, Completed = 3,
Failed = 4 Failed = 4,
Warning = 5
} }
} }

View File

@ -107,6 +107,7 @@ namespace NzbDrone.Core.Download
v.DownloadItem.Status == DownloadItemStatus.Queued || v.DownloadItem.Status == DownloadItemStatus.Queued ||
v.DownloadItem.Status == DownloadItemStatus.Paused || v.DownloadItem.Status == DownloadItemStatus.Paused ||
v.DownloadItem.Status == DownloadItemStatus.Downloading || v.DownloadItem.Status == DownloadItemStatus.Downloading ||
v.DownloadItem.Status == DownloadItemStatus.Warning ||
v.DownloadItem.Status == DownloadItemStatus.Failed && enabledFailedDownloadHandling || v.DownloadItem.Status == DownloadItemStatus.Failed && enabledFailedDownloadHandling ||
v.DownloadItem.Status == DownloadItemStatus.Completed && enabledCompletedDownloadHandling) v.DownloadItem.Status == DownloadItemStatus.Completed && enabledCompletedDownloadHandling)
.ToArray(); .ToArray();

View File

@ -105,15 +105,6 @@ namespace NzbDrone.Core.Download
} }
else else
{ {
//TODO: Make this more configurable (ignore failure reasons) to support changes and other failures that should be ignored
if (!trackedDownload.DownloadItem.Message.IsNullOrWhiteSpace() &&
trackedDownload.DownloadItem.Message.Equals("Unpacking failed, write error or disk is full?",
StringComparison.InvariantCultureIgnoreCase))
{
UpdateStatusMessage(trackedDownload, LogLevel.Error, "Download failed due to lack of disk space, not blacklisting.");
return;
}
if (FailedDownloadForRecentRelease(downloadClient, trackedDownload, grabbedItems)) if (FailedDownloadForRecentRelease(downloadClient, trackedDownload, grabbedItems))
{ {
_logger.Debug("[{0}] Recent release Failed, do not blacklist.", trackedDownload.DownloadItem.Title); _logger.Debug("[{0}] Recent release Failed, do not blacklist.", trackedDownload.DownloadItem.Title);

View File

@ -80,6 +80,10 @@ define(
this._addStatusIcon(element, 'icon-nd-download-failed', 'Download failed: check download client for more details'); this._addStatusIcon(element, 'icon-nd-download-failed', 'Download failed: check download client for more details');
} }
else if (status === 'warning') {
this._addStatusIcon(element, 'icon-nd-download-warning', 'Download warning: check download client for more details');
}
else { else {
this.$(element).find('.fc-event-time') this.$(element).find('.fc-event-time')
.after('<span class="chart pull-right" data-percent="{0}"></span>'.format(progress)); .after('<span class="chart pull-right" data-percent="{0}"></span>'.format(progress));

View File

@ -173,6 +173,11 @@
color: @brand-danger; color: @brand-danger;
} }
.icon-nd-download-warning:before {
.icon(@cloud-download);
color: @brand-warning;
}
.icon-nd-shutdown:before { .icon-nd-shutdown:before {
.icon(@off); .icon(@off);
color: @brand-danger; color: @brand-danger;

View File

@ -42,6 +42,11 @@ define(
title = 'Download failed: check download client for more details'; title = 'Download failed: check download client for more details';
} }
if (status === 'warning') {
icon = 'icon-nd-download-warning';
title = 'Download warning: check download client for more details';
}
if (errorMessage !== '') { if (errorMessage !== '') {
if (status === 'completed') { if (status === 'completed') {
icon = 'icon-nd-import-failed'; icon = 'icon-nd-import-failed';