mirror of
https://github.com/zoriya/flood.git
synced 2025-12-19 13:45:15 +00:00
Expose opt to use path as basePath in moveTorrents
This commit is contained in:
@@ -272,8 +272,15 @@ class ClientRequest {
|
|||||||
setDownloadPath(options) {
|
setDownloadPath(options) {
|
||||||
let hashes = this.getEnsuredArray(options.hashes);
|
let hashes = this.getEnsuredArray(options.hashes);
|
||||||
|
|
||||||
|
let pathMethod;
|
||||||
|
if (options.isBasePath) {
|
||||||
|
pathMethod = 'd.directory_base.set';
|
||||||
|
} else {
|
||||||
|
pathMethod = 'd.directory.set'
|
||||||
|
}
|
||||||
|
|
||||||
hashes.forEach((hash) => {
|
hashes.forEach((hash) => {
|
||||||
this.requests.push(this.getMethodCall('d.directory.set',
|
this.requests.push(this.getMethodCall(pathMethod,
|
||||||
[hash, options.path]));
|
[hash, options.path]));
|
||||||
this.requests.push(this.getMethodCall('d.open', [hash]));
|
this.requests.push(this.getMethodCall('d.open', [hash]));
|
||||||
this.requests.push(this.getMethodCall('d.close', [hash]));
|
this.requests.push(this.getMethodCall('d.close', [hash]));
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ var client = {
|
|||||||
|
|
||||||
moveTorrents: (data, callback) => {
|
moveTorrents: (data, callback) => {
|
||||||
let destinationPath = data.destination;
|
let destinationPath = data.destination;
|
||||||
|
let isBasePath = data.isBasePath;
|
||||||
let hashes = data.hashes;
|
let hashes = data.hashes;
|
||||||
let filenames = data.filenames;
|
let filenames = data.filenames;
|
||||||
let moveFiles = data.moveFiles;
|
let moveFiles = data.moveFiles;
|
||||||
@@ -264,7 +265,7 @@ var client = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainRequest.stopTorrents({hashes});
|
mainRequest.stopTorrents({hashes});
|
||||||
mainRequest.setDownloadPath({hashes, path: destinationPath});
|
mainRequest.setDownloadPath({hashes, path: destinationPath, isBasePath});
|
||||||
mainRequest.onComplete(afterSetPath);
|
mainRequest.onComplete(afterSetPath);
|
||||||
mainRequest.send();
|
mainRequest.send();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user