From 20ed015025f44bc967c7cf0d12062cc4b7f79d2c Mon Sep 17 00:00:00 2001 From: nVitius Date: Sun, 30 Apr 2017 23:10:08 -0700 Subject: [PATCH] Expose opt to use path as basePath in moveTorrents --- server/models/ClientRequest.js | 9 ++++++++- server/models/client.js | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/models/ClientRequest.js b/server/models/ClientRequest.js index bdbd8304..f9622446 100644 --- a/server/models/ClientRequest.js +++ b/server/models/ClientRequest.js @@ -272,8 +272,15 @@ class ClientRequest { setDownloadPath(options) { let hashes = this.getEnsuredArray(options.hashes); + let pathMethod; + if (options.isBasePath) { + pathMethod = 'd.directory_base.set'; + } else { + pathMethod = 'd.directory.set' + } + hashes.forEach((hash) => { - this.requests.push(this.getMethodCall('d.directory.set', + this.requests.push(this.getMethodCall(pathMethod, [hash, options.path])); this.requests.push(this.getMethodCall('d.open', [hash])); this.requests.push(this.getMethodCall('d.close', [hash])); diff --git a/server/models/client.js b/server/models/client.js index 7d26737b..a2685570 100644 --- a/server/models/client.js +++ b/server/models/client.js @@ -228,6 +228,7 @@ var client = { moveTorrents: (data, callback) => { let destinationPath = data.destination; + let isBasePath = data.isBasePath; let hashes = data.hashes; let filenames = data.filenames; let moveFiles = data.moveFiles; @@ -264,7 +265,7 @@ var client = { } mainRequest.stopTorrents({hashes}); - mainRequest.setDownloadPath({hashes, path: destinationPath}); + mainRequest.setDownloadPath({hashes, path: destinationPath, isBasePath}); mainRequest.onComplete(afterSetPath); mainRequest.send(); },