From 783c27a5840ae6c67afd63af6bf593a7f78e2269 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 8 Jun 2018 16:38:05 -0700 Subject: [PATCH] Fixed: Initially pausing torrents in QBittorrent Fixes #2599 --- .../Download/Clients/QBittorrent/QBittorrentProxy.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs index 0b8fc32e5b..600802a730 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs @@ -80,6 +80,11 @@ public void AddTorrentFromUrl(string torrentUrl, QBittorrentSettings settings) request.AddFormParameter("category", settings.TvCategory); } + if ((QBittorrentState)settings.InitialState == QBittorrentState.Pause) + { + request.AddFormParameter("paused", true); + } + var result = ProcessRequest(request, settings); // Note: Older qbit versions returned nothing, so we can't do != "Ok." here. @@ -100,6 +105,11 @@ public void AddTorrentFromFile(string fileName, Byte[] fileContent, QBittorrentS request.AddFormParameter("category", settings.TvCategory); } + if ((QBittorrentState)settings.InitialState == QBittorrentState.Pause) + { + request.AddFormParameter("paused", true); + } + var result = ProcessRequest(request, settings); // Note: Current qbit versions return nothing, so we can't do != "Ok." here. @@ -156,7 +166,7 @@ public void MoveTorrentToTopInQueue(string hash, QBittorrentSettings settings) catch (DownloadClientException ex) { // qBittorrent rejects all Prio commands with 403: Forbidden if Options -> BitTorrent -> Torrent Queueing is not enabled -#warning FIXME: so wouldn't the reauthenticate logic trigger on Forbidden? + #warning FIXME: so wouldn't the reauthenticate logic trigger on Forbidden? if (ex.InnerException is HttpException && (ex.InnerException as HttpException).Response.StatusCode == HttpStatusCode.Forbidden) { return;