1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-17 10:45:49 +02:00

Moving and Removing of downloads in usenet clients

Fixed: Moving items triggered via post-processing scripts
Fixed: Removing failed downloads fromusenet clients
This commit is contained in:
Mark McDowall 2017-04-12 17:41:10 -07:00
parent f8b8fcfb8d
commit f36d5dc881
4 changed files with 43 additions and 6 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Collections.Generic;
using FluentAssertions;
@ -107,6 +107,9 @@ public void queued_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyQueued(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -118,6 +121,9 @@ public void paused_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyPaused(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -129,6 +135,9 @@ public void downloading_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyDownloading(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -152,6 +161,9 @@ public void failed_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyFailed(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Collections.Generic;
using FluentAssertions;
@ -167,6 +167,9 @@ public void queued_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyQueued(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -180,6 +183,9 @@ public void paused_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyPaused(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -193,6 +199,9 @@ public void downloading_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyDownloading(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Collections.Generic;
using FizzWare.NBuilder;
@ -191,7 +191,10 @@ public void queued_item_should_have_required_properties(SabnzbdDownloadStatus st
var result = Subject.GetItems().Single();
VerifyQueued(result);
result.RemainingTime.Should().NotBe(TimeSpan.Zero);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[TestCase(SabnzbdDownloadStatus.Paused)]
@ -205,6 +208,9 @@ public void paused_item_should_have_required_properties(SabnzbdDownloadStatus st
var result = Subject.GetItems().Single();
VerifyPaused(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[TestCase(SabnzbdDownloadStatus.Checking)]
@ -227,7 +233,10 @@ public void downloading_item_should_have_required_properties(SabnzbdDownloadStat
var result = Subject.GetItems().Single();
VerifyDownloading(result);
result.RemainingTime.Should().NotBe(TimeSpan.Zero);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]
@ -255,6 +264,9 @@ public void failed_item_should_have_required_properties()
var result = Subject.GetItems().Single();
VerifyFailed(result);
result.CanBeRemoved.Should().BeTrue();
result.CanMoveFiles.Should().BeTrue();
}
[Test]

View File

@ -78,6 +78,8 @@ private IEnumerable<DownloadClientItem> GetQueue()
queueItem.TotalSize = (long)(sabQueueItem.Size * 1024 * 1024);
queueItem.RemainingSize = (long)(sabQueueItem.Sizeleft * 1024 * 1024);
queueItem.RemainingTime = sabQueueItem.Timeleft;
queueItem.CanBeRemoved = true;
queueItem.CanMoveFiles = true;
if (sabQueue.Paused || sabQueueItem.Status == SabnzbdDownloadStatus.Paused)
{
@ -142,7 +144,10 @@ private IEnumerable<DownloadClientItem> GetHistory()
RemainingSize = 0,
RemainingTime = TimeSpan.Zero,
Message = sabHistoryItem.FailMessage
Message = sabHistoryItem.FailMessage,
CanBeRemoved = true,
CanMoveFiles = true
};
if (sabHistoryItem.Status == SabnzbdDownloadStatus.Failed)
@ -160,8 +165,6 @@ private IEnumerable<DownloadClientItem> GetHistory()
else if (sabHistoryItem.Status == SabnzbdDownloadStatus.Completed)
{
historyItem.Status = DownloadItemStatus.Completed;
historyItem.CanBeRemoved = true;
historyItem.CanMoveFiles = true;
}
else // Verifying/Moving etc
{
@ -185,6 +188,7 @@ private IEnumerable<DownloadClientItem> GetHistory()
}
}
historyItems.Add(historyItem);
}