Skip to content

Commit

Permalink
Merge pull request ziahamza#339 from carlnorum/ratio
Browse files Browse the repository at this point in the history
Display upload ratio.
  • Loading branch information
ziahamza authored Apr 23, 2017
2 parents 6b9ea1d + 1fcdebe commit 5afa0b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@
<span title="{{ 'Uploaded' | translate }}"><span class="fa fa-fw fa-upload">&nbsp;</span> {{download.fmtUploadLength}}</span>
</li>

<li class="label label-active hidden-phone">
<span title="{{ 'Ratio' | translate }}">{{ 'Ratio' | translate }}&nbsp;{{getRatio(download)}}</span>
</li>

<li class="label label-active hidden-phone hidden-tablet">
<span title="{{ 'Progress' | translate }}"><span class="fa fa-fw fa-chevron-right">&nbsp;</span> {{getProgress(download)}}%</span>
</li>
Expand Down Expand Up @@ -701,6 +705,10 @@
<span title="{{ 'Uploaded' | translate }}"><span class="fa fa-fw fa-upload">&nbsp;</span> {{download.fmtUploadLength}}</span>
</li>

<li class="label label-active hidden-phone">
<span title="{{ 'Ratio' | translate }}">{{ 'Ratio' | translate }}&nbsp;{{getRatio(download)}}</span>
</li>

<li class="label label-success hidden-phone">
<span title="{{ 'Download Path' | translate }}"><span class="fa fa-fw fa-folder-open">&nbsp;</span> {{download.dir}}</span>
</li>
Expand Down Expand Up @@ -763,6 +771,7 @@

<li class="label label-default" title="{{ 'Upload Speed' | translate }}" ng-show="download.bittorrent"><i class="fa fa-fw fa-arrow-circle-o-up">&nbsp;</i> <span class="download-uploadSpeed">{{download.fmtUploadSpeed}}</span></li>
<li class="label label-default" title="{{ 'Uploaded' | translate }}" ng-show="download.bittorrent"><i class="fa fa-fw fa-upload">&nbsp;</i> <span class="download-uploadLength">{{download.fmtUploadLength}}</span></li>
<li class="label label-default" title="{{ 'Ratio' | translate }}" ng-show="download.bittorrent"><span title="{{ 'Ratio' | translate }}">{{ 'Ratio' | translate }}&nbsp;{{getRatio(download)}}</span></li>

<li class="label label-default" title={{download.connectionsTitle}}><i class="fa fa-fw fa-link">&nbsp;</i> <span class="download-connections">{{download.connections}}{{download.numSeeders}}</span></li>

Expand Down
10 changes: 10 additions & 0 deletions js/ctrls/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,16 @@ function(
return percentage;
};

// gets the upload ratio
scope.getRatio = function(d) {
var ratio = 0
ratio = (d.uploadLength / d.completedLength) || 0;
ratio = ratio.toFixed(2);
if(!ratio) ratio = 0;

return ratio;
};

// gets the type for the download as classified by the aria2 rpc calls
scope.getType = function(d) {
var type = d.status;
Expand Down

0 comments on commit 5afa0b3

Please sign in to comment.