diff --git a/server/services/qBittorrent/clientGatewayService.ts b/server/services/qBittorrent/clientGatewayService.ts index b300a734..dc1e40f8 100644 --- a/server/services/qBittorrent/clientGatewayService.ts +++ b/server/services/qBittorrent/clientGatewayService.ts @@ -36,28 +36,38 @@ class QBittorrentClientGatewayService extends ClientGatewayService { clientRequestManager = new ClientRequestManager(this.user.client as QBittorrentConnectionSettings); cachedProperties: Record> = {}; - async addTorrentsByFile({files, destination, isBasePath, start}: Required): Promise { + async addTorrentsByFile({ + files, + destination, + tags, + isBasePath, + start, + }: Required): Promise { const fileBuffers = files.map((file) => { return Buffer.from(file, 'base64'); }); - // TODO: qBittorrent does not have capability to add tags during add torrents. - return this.clientRequestManager .torrentsAddFiles(fileBuffers, { savepath: destination, + tags: tags.join(','), paused: !start, root_folder: !isBasePath, }) .then(this.processClientRequestSuccess, this.processClientRequestError); } - async addTorrentsByURL({urls, destination, isBasePath, start}: Required): Promise { - // TODO: qBittorrent does not have capability to add tags during add torrents. - + async addTorrentsByURL({ + urls, + destination, + tags, + isBasePath, + start, + }: Required): Promise { return this.clientRequestManager .torrentsAddURLs(urls, { savepath: destination, + tags: tags.join(','), paused: !start, root_folder: !isBasePath, }) diff --git a/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts b/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts index 5858397f..943686ee 100644 --- a/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts +++ b/server/services/qBittorrent/types/QBittorrentTorrentsMethods.ts @@ -117,6 +117,8 @@ export interface QBittorrentTorrentsAddOptions { cookie?: string; // Category for the torrent category?: string; + // Tags for the torrent, split by ',' + tags?: string; // Skip hash checking. Possible values are true, false (default) skip_checking?: boolean; // Add torrents in the paused state. Possible values are true, false (default)