server: migrate setTorrentsTags and setTorrentContentsPriority to clientGatewayService

This commit is contained in:
Jesse Chan
2020-10-08 21:13:05 +08:00
parent 79a7c9c6f0
commit 7a687fb1be
9 changed files with 120 additions and 77 deletions
-32
View File
@@ -118,18 +118,6 @@ class ClientRequest {
this.requests.push(getMethodCall('t.multicall', trackerParams));
}
setFilePriority(options) {
const indices = getEnsuredArray(options.indices);
const hashes = getEnsuredArray(options.hashes);
hashes.forEach((hash) => {
indices.forEach((index) => {
this.requests.push(getMethodCall('f.priority.set', [`${hash}:f${index}`, options.priority]));
});
this.requests.push(getMethodCall('d.update_priorities', [hash]));
});
}
setSettings(options) {
const settings = getEnsuredArray(options.settings);
@@ -138,26 +126,6 @@ class ClientRequest {
});
}
setTaxonomy(options) {
const methodName = 'd.custom1.set';
const tags = options.tags
.reduce((memo, currentTag) => {
const tag = encodeURIComponent(currentTag.trim());
if (tag !== '' && memo.indexOf(tag) === -1) {
memo.push(tag);
}
return memo;
}, [])
.join(',');
getEnsuredArray(options.hashes).forEach((hash) => {
this.requests.push(getMethodCall(methodName, [hash, tags]));
});
}
setTracker(options) {
const existingTrackerIndex = 0;
const {tracker} = options;