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]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_settings = new PutioSettings
|
_settings = new PutioSettings();
|
||||||
{
|
|
||||||
SaveParentId = "1",
|
|
||||||
};
|
|
||||||
|
|
||||||
Subject.Definition = new DownloadClientDefinition();
|
Subject.Definition = new DownloadClientDefinition();
|
||||||
Subject.Definition.Settings = _settings;
|
Subject.Definition.Settings = _settings;
|
||||||
|
@ -74,8 +71,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
|
||||||
FileId = 1
|
FileId = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
_completed_different_parent = _completed;
|
_completed_different_parent = new PutioTorrent
|
||||||
_completed_different_parent.SaveParentId = 2;
|
{
|
||||||
|
Hash = "HASH",
|
||||||
|
Status = PutioTorrentStatus.Completed,
|
||||||
|
Name = _title,
|
||||||
|
Size = 1000,
|
||||||
|
Downloaded = 1000,
|
||||||
|
SaveParentId = 2,
|
||||||
|
FileId = 1
|
||||||
|
};
|
||||||
|
|
||||||
_seeding = new PutioTorrent
|
_seeding = new PutioTorrent
|
||||||
{
|
{
|
||||||
|
@ -166,6 +171,26 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
|
||||||
items.Should().HaveCount(6);
|
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("WAITING", DownloadItemStatus.Queued)]
|
||||||
[TestCase("PREPARING_DOWNLOAD", DownloadItemStatus.Queued)]
|
[TestCase("PREPARING_DOWNLOAD", DownloadItemStatus.Queued)]
|
||||||
[TestCase("COMPLETED", DownloadItemStatus.Completed)]
|
[TestCase("COMPLETED", DownloadItemStatus.Completed)]
|
||||||
|
|
|
@ -74,6 +74,12 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.SaveParentId.IsNotNullOrWhiteSpace() && torrent.SaveParentId != long.Parse(Settings.SaveParentId))
|
||||||
|
{
|
||||||
|
// torrent is not related to our parent folder
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var item = new DownloadClientItem
|
var item = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadId = torrent.Id.ToString(),
|
DownloadId = torrent.Id.ToString(),
|
||||||
|
@ -88,6 +94,8 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
{
|
{
|
||||||
if (torrent.FileId != 0)
|
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 file = _proxy.GetFile(torrent.FileId, Settings);
|
||||||
var torrentPath = "/completed/" + file.Name;
|
var torrentPath = "/completed/" + file.Name;
|
||||||
|
|
Loading…
Reference in New Issue