diff --git a/server/services/qBittorrent/clientGatewayService.ts b/server/services/qBittorrent/clientGatewayService.ts index c9c86ba98..63c28a029 100644 --- a/server/services/qBittorrent/clientGatewayService.ts +++ b/server/services/qBittorrent/clientGatewayService.ts @@ -38,6 +38,7 @@ import {getDomainsFromURLs} from '../../util/torrentPropertiesUtil'; import ClientGatewayService from '../clientGatewayService'; import ClientRequestManager from './clientRequestManager'; import {QBittorrentTorrentContentPriority, QBittorrentTorrentTrackerStatus} from './types/QBittorrentTorrentsMethods'; +import {isApiVersionAtLeast} from './util/apiVersionCheck'; import { getTorrentPeerPropertiesFromFlags, getTorrentStatusFromState, @@ -88,7 +89,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService { .torrentsAddFiles(fileBuffers, { savepath: destination, tags: tags.join(','), - paused: !start, + [isApiVersionAtLeast(this.clientRequestManager.apiVersion, '2.11.0') ? 'stopped' : 'paused']: !start, root_folder: !isBasePath, contentLayout: isBasePath ? 'NoSubfolder' : undefined, sequentialDownload: isSequential, @@ -122,7 +123,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService { .torrentsAddURLs(urls, { savepath: destination, tags: tags.join(','), - paused: !start, + [isApiVersionAtLeast(this.clientRequestManager.apiVersion, '2.11.0') ? 'stopped' : 'paused']: !start, root_folder: !isBasePath, contentLayout: isBasePath ? 'NoSubfolder' : undefined, sequentialDownload: isSequential, diff --git a/server/services/qBittorrent/clientRequestManager.ts b/server/services/qBittorrent/clientRequestManager.ts index 4bc35f2ed..2bd32130a 100644 --- a/server/services/qBittorrent/clientRequestManager.ts +++ b/server/services/qBittorrent/clientRequestManager.ts @@ -36,7 +36,7 @@ const EMPTY_SERVER_STATE = { class ClientRequestManager { private connectionSettings: QBittorrentConnectionSettings; private apiBase: string; - private apiVersion: string | null = null; + apiVersion: string | null = null; private authCookie: Promise = Promise.resolve(undefined); private isMainDataPending = false; diff --git a/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts b/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts index 10b8daeb0..6b2210bb3 100644 --- a/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts +++ b/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts @@ -123,6 +123,8 @@ export interface QBittorrentTorrentsAddOptions { skip_checking?: boolean; // Add torrents in the paused state. Possible values are true, false (default) paused?: boolean; + // Add torrents in the stopped state (using webapiVersion v2.11.0 or later). Possible values are true, false (default) + stopped?: boolean; // Create the root folder. Possible values are true, false, unset (default) root_folder?: boolean; // Content layout mode, replaces root_folder