1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-02-24 15:11:27 +00:00

Fixed: Adding label to torrents in qBittorrent v3.3.5

Fixes #1347
This commit is contained in:
vintage81 2016-06-30 02:48:18 +01:00 committed by Mark McDowall
parent ba817557ba
commit 3e9a159466

View file

@ -94,12 +94,26 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
public void SetTorrentLabel(string hash, string label, QBittorrentSettings settings) public void SetTorrentLabel(string hash, string label, QBittorrentSettings settings)
{ {
var request = BuildRequest(settings).Resource("/command/setLabel") var setCategoryRequest = BuildRequest(settings).Resource("/command/setCategory")
.Post() .Post()
.AddFormParameter("hashes", hash) .AddFormParameter("hashes", hash)
.AddFormParameter("label", label); .AddFormParameter("category", label);
try
ProcessRequest<object>(request, settings); {
ProcessRequest<object>(setCategoryRequest, settings);
}
catch(DownloadClientException ex)
{
// if setCategory fails due to method not being found, then try older setLabel command for qbittorent < v.3.3.5
if (ex.InnerException is HttpException && (ex.InnerException as HttpException).Response.StatusCode == HttpStatusCode.NotFound)
{
var setLabelRequest = BuildRequest(settings).Resource("/command/setLabel")
.Post()
.AddFormParameter("hashes", hash)
.AddFormParameter("label", label);
ProcessRequest<object>(setLabelRequest, settings);
}
}
} }
public void MoveTorrentToTopInQueue(string hash, QBittorrentSettings settings) public void MoveTorrentToTopInQueue(string hash, QBittorrentSettings settings)