Fixed: Use Category from qBittorrent when set instead of Label

pull/2/head
Mark McDowall 8 years ago
parent c1de7f26d1
commit 7f8093de92

@ -401,5 +401,55 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
var item = Subject.GetItems().Single(); var item = Subject.GetItems().Single();
item.IsReadOnly.Should().BeFalse(); item.IsReadOnly.Should().BeFalse();
} }
[Test]
public void should_get_category_from_the_category_if_set()
{
const string category = "tv-sonarr";
GivenMaxRatio(1.0f);
var torrent = new QBittorrentTorrent
{
Hash = "HASH",
Name = _title,
Size = 1000,
Progress = 1.0,
Eta = 8640000,
State = "pausedUP",
Category = category,
SavePath = "",
Ratio = 1.0f
};
GivenTorrents(new List<QBittorrentTorrent> { torrent });
var item = Subject.GetItems().Single();
item.Category.Should().Be(category);
}
[Test]
public void should_get_category_from_the_label_if_the_category_is_not_available()
{
const string category = "tv-sonarr";
GivenMaxRatio(1.0f);
var torrent = new QBittorrentTorrent
{
Hash = "HASH",
Name = _title,
Size = 1000,
Progress = 1.0,
Eta = 8640000,
State = "pausedUP",
Label = category,
SavePath = "",
Ratio = 1.0f
};
GivenTorrents(new List<QBittorrentTorrent> { torrent });
var item = Subject.GetItems().Single();
item.Category.Should().Be(category);
}
} }
} }

@ -101,7 +101,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
{ {
var item = new DownloadClientItem(); var item = new DownloadClientItem();
item.DownloadId = torrent.Hash.ToUpper(); item.DownloadId = torrent.Hash.ToUpper();
item.Category = torrent.Label; item.Category = torrent.Category.IsNotNullOrWhiteSpace() ? torrent.Category : torrent.Label;
item.Title = torrent.Name; item.Title = torrent.Name;
item.TotalSize = torrent.Size; item.TotalSize = torrent.Size;
item.DownloadClient = Definition.Name; item.DownloadClient = Definition.Name;

@ -18,6 +18,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
public string State { get; set; } // Torrent state. See possible values here below public string State { get; set; } // Torrent state. See possible values here below
public string Label { get; set; } // Label of the torrent public string Label { get; set; } // Label of the torrent
public string Category { get; set; } // Category of the torrent (3.3.5+)
[JsonProperty(PropertyName = "save_path")] [JsonProperty(PropertyName = "save_path")]
public string SavePath { get; set; } // Torrent save path public string SavePath { get; set; } // Torrent save path

Loading…
Cancel
Save