mirror of
https://github.com/zoriya/flood.git
synced 2026-06-06 12:02:13 +00:00
Add peer and file data to torrent detail retrieval
This commit is contained in:
+27
-4
@@ -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);
|
||||
});
|
||||
|
||||
@@ -31,8 +31,8 @@ var clientUtil = {
|
||||
'peersNotConnected',
|
||||
'trackerFocus',
|
||||
|
||||
'basePath',
|
||||
'creationDate',
|
||||
'directory',
|
||||
'filename',
|
||||
|
||||
'seeding',
|
||||
'added'
|
||||
@@ -68,12 +68,26 @@ var clientUtil = {
|
||||
'd.get_peers_not_connected=',
|
||||
'd.get_tracker_focus=',
|
||||
|
||||
'd.get_base_path=',
|
||||
'd.get_creation_date=',
|
||||
'd.get_directory=',
|
||||
'd.get_base_filename=',
|
||||
|
||||
'd.get_custom=seedingtime',
|
||||
'd.get_custom=addtime'
|
||||
],
|
||||
fileProperties: [
|
||||
'path',
|
||||
'pathComponents',
|
||||
'pathDepth',
|
||||
'priority',
|
||||
'sizeBytes'
|
||||
],
|
||||
filePropertyMethods: [
|
||||
'f.get_path=',
|
||||
'f.get_path_components=',
|
||||
'f.get_path_depth=',
|
||||
'f.get_priority=',
|
||||
'f.get_size_bytes='
|
||||
],
|
||||
clientProperties: [
|
||||
'uploadRate',
|
||||
'uploadTotal',
|
||||
|
||||
Reference in New Issue
Block a user