Filter Items by ParentFolder
This commit is contained in:
parent
4452d1c9bf
commit
16ccff35bc
|
@ -24,10 +24,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
|
|||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_settings = new PutioSettings
|
||||
{
|
||||
SaveParentId = "1",
|
||||
};
|
||||
_settings = new PutioSettings();
|
||||
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = _settings;
|
||||
|
@ -74,8 +71,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
|
|||
FileId = 1
|
||||
};
|
||||
|
||||
_completed_different_parent = _completed;
|
||||
_completed_different_parent.SaveParentId = 2;
|
||||
_completed_different_parent = new PutioTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = PutioTorrentStatus.Completed,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Downloaded = 1000,
|
||||
SaveParentId = 2,
|
||||
FileId = 1
|
||||
};
|
||||
|
||||
_seeding = new PutioTorrent
|
||||
{
|
||||
|
@ -166,6 +171,26 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
|
|||
items.Should().HaveCount(6);
|
||||
}
|
||||
|
||||
[TestCase("1", 5)]
|
||||
[TestCase("2", 1)]
|
||||
[TestCase("3", 0)]
|
||||
public void getItems_contains_only_items_with_matching_parent_id(string configuredParentId, int expectedCount)
|
||||
{
|
||||
GivenTorrents(new List<PutioTorrent>
|
||||
{
|
||||
_queued,
|
||||
_downloading,
|
||||
_failed,
|
||||
_completed,
|
||||
_seeding,
|
||||
_completed_different_parent
|
||||
});
|
||||
|
||||
_settings.SaveParentId = configuredParentId;
|
||||
|
||||
Subject.GetItems().Should().HaveCount(expectedCount);
|
||||
}
|
||||
|
||||
[TestCase("WAITING", DownloadItemStatus.Queued)]
|
||||
[TestCase("PREPARING_DOWNLOAD", DownloadItemStatus.Queued)]
|
||||
[TestCase("COMPLETED", DownloadItemStatus.Completed)]
|
||||
|
|
|
@ -74,6 +74,12 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Settings.SaveParentId.IsNotNullOrWhiteSpace() && torrent.SaveParentId != long.Parse(Settings.SaveParentId))
|
||||
{
|
||||
// torrent is not related to our parent folder
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = new DownloadClientItem
|
||||
{
|
||||
DownloadId = torrent.Id.ToString(),
|
||||
|
@ -88,6 +94,8 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
|||
{
|
||||
if (torrent.FileId != 0)
|
||||
{
|
||||
// How needs the output path need to look if we have remote files?
|
||||
|
||||
/*
|
||||
var file = _proxy.GetFile(torrent.FileId, Settings);
|
||||
var torrentPath = "/completed/" + file.Name;
|
||||
|
|
Loading…
Reference in New Issue