Add priority meter to files

This commit is contained in:
John Furrow
2016-02-10 23:41:00 -08:00
parent 778e5a3b41
commit 0fd6fd7d11
17 changed files with 497 additions and 164 deletions

View File

@@ -130,8 +130,12 @@ var client = {
clientUtil.defaults.fileProperties,
filesData
);
files = files.map(function (file) {
file.filename = file.pathComponents[file.pathComponents.length - 1];
file.percentComplete = (file.completedChunks / file.sizeChunks * 100).toFixed(0);
delete(file.completedChunks);
delete(file.sizeChunks);
return file;
});
}
@@ -180,6 +184,36 @@ var client = {
});
},
setPriority: function (hash, data, callback) {
// TODO Add support for multiple hashes.
var fileIndex = data.fileIndices[0];
var multicall = [
[
{
methodName: 'f.priority.set',
params: [
hash + ':f' + fileIndex,
data.priority
]
},
{
methodName: 'd.update_priorities',
params: [
hash
]
}
]
];
rTorrent.get('system.multicall', multicall)
.then(function(data) {
callback(null, data);
}, function(error) {
callback(error, null);
});
},
setSpeedLimits: function(data, callback) {
var methodName = 'throttle.global_down.max_rate.set';