mirror of
https://github.com/zoriya/flood.git
synced 2026-06-01 18:47:44 +00:00
server: qBittorrent: allow to attach tags while adding torrents
Needs: qbittorrent/qBittorrent#13882
This commit is contained in:
@@ -36,28 +36,38 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
|
||||
clientRequestManager = new ClientRequestManager(this.user.client as QBittorrentConnectionSettings);
|
||||
cachedProperties: Record<string, Pick<TorrentProperties, 'dateCreated' | 'isPrivate' | 'trackerURIs'>> = {};
|
||||
|
||||
async addTorrentsByFile({files, destination, isBasePath, start}: Required<AddTorrentByFileOptions>): Promise<void> {
|
||||
async addTorrentsByFile({
|
||||
files,
|
||||
destination,
|
||||
tags,
|
||||
isBasePath,
|
||||
start,
|
||||
}: Required<AddTorrentByFileOptions>): Promise<void> {
|
||||
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<AddTorrentByURLOptions>): Promise<void> {
|
||||
// TODO: qBittorrent does not have capability to add tags during add torrents.
|
||||
|
||||
async addTorrentsByURL({
|
||||
urls,
|
||||
destination,
|
||||
tags,
|
||||
isBasePath,
|
||||
start,
|
||||
}: Required<AddTorrentByURLOptions>): Promise<void> {
|
||||
return this.clientRequestManager
|
||||
.torrentsAddURLs(urls, {
|
||||
savepath: destination,
|
||||
tags: tags.join(','),
|
||||
paused: !start,
|
||||
root_folder: !isBasePath,
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user