Add peer and file data to torrent detail retrieval

This commit is contained in:
John Furrow
2015-11-21 23:19:16 -08:00
parent 4e76edb9a6
commit 345825c02c
2 changed files with 45 additions and 8 deletions
+27 -4
View File
@@ -52,14 +52,37 @@ var client = {
},
getTorrentDetails: function(hash, callback) {
var params = [hash, ''].concat(clientUtil.defaults.peerPropertyMethods);
rTorrent.get('p.multicall', params)
var peerParams = [hash, ''].concat(clientUtil.defaults.peerPropertyMethods);
var fileParams = [hash, ''].concat(clientUtil.defaults.filePropertyMethods);
var multicall = [
[]
];
multicall[0].push({
methodName: 'p.multicall',
params: peerParams
});
multicall[0].push({
methodName: 'f.multicall',
params: fileParams
});
rTorrent.get('system.multicall', multicall)
.then(function(data) {
var peers = clientUtil.mapClientProps(
clientUtil.defaults.peerProperties,
data
data[0][0]
);
callback(null, peers);
var files = clientUtil.mapClientProps(
clientUtil.defaults.fileProperties,
data[1][0]
);
callback(null, {
peers: peers,
files: files
});
}, function(error) {
callback(error, null);
});