diff --git a/app/langs/zh_CN.json b/app/langs/zh_CN.json index 1c83a6f..953f81c 100644 --- a/app/langs/zh_CN.json +++ b/app/langs/zh_CN.json @@ -65,6 +65,7 @@ "Status": "状态", "Percent": "完成度", "Speed": "速度", + "(local)": "(本机)", "No Data": "无数据", "No connected peers": "没有连接到其他节点", "Failed to change some tasks state.": "修改一些任务状态时失败.", diff --git a/app/scripts/config/defaultLanguage.js b/app/scripts/config/defaultLanguage.js index 5e0a5bf..abb69d8 100644 --- a/app/scripts/config/defaultLanguage.js +++ b/app/scripts/config/defaultLanguage.js @@ -69,6 +69,7 @@ 'Status': 'Status', 'Percent': 'Percent', 'Speed': 'Speed', + '(local)': '(local)', 'No Data': 'No Data', 'No connected peers': 'No connected peers', 'Failed to change some tasks state.': 'Failed to change some tasks state.', diff --git a/app/scripts/controllers/task-detail.js b/app/scripts/controllers/task-detail.js index fe6350d..35c6080 100644 --- a/app/scripts/controllers/task-detail.js +++ b/app/scripts/controllers/task-detail.js @@ -27,6 +27,7 @@ } var peers = response.data; + peers.push(aria2TaskService.createLocalPeerFromTask(task)); if (!ariaNgCommonService.extendArray(peers, $scope.peers, 'peerId')) { $scope.peers = peers; diff --git a/app/scripts/services/aria2TaskService.js b/app/scripts/services/aria2TaskService.js index d58e3e2..99c2f5a 100644 --- a/app/scripts/services/aria2TaskService.js +++ b/app/scripts/services/aria2TaskService.js @@ -185,7 +185,13 @@ for (var i = 0; i < peers.length; i++) { var peer = peers[i]; + var upstreamToSpeed = peer.uploadSpeed; + var downstreamFromSpeed = peer.downloadSpeed; + + peer.name = peer.ip + ':' + peer.port; peer.completePercent = estimateCompletedPercentFromBitField(peer.bitfield) * 100; + peer.downloadSpeed = upstreamToSpeed; + peer.uploadSpeed = downstreamFromSpeed; } } @@ -283,6 +289,17 @@ processDownloadTask(tasks[i]); } }, + createLocalPeerFromTask: function (task) { + return { + local: true, + bitfield: task.bitfield, + completePercent: task.completePercent, + downloadSpeed: task.downloadSpeed, + name: '(local)', + seeder: task.seeder, + uploadSpeed: task.uploadSpeed + }; + }, getPieceStatus: function (bitField, pieceCount) { var pieces = []; diff --git a/app/views/task-detail.html b/app/views/task-detail.html index 9a4831a..21db627 100644 --- a/app/views/task-detail.html +++ b/app/views/task-detail.html @@ -214,7 +214,7 @@