UserScript + Torrents size

This commit is contained in:
Simon Vieille 2015-08-15 18:35:06 +02:00
parent 59154341ea
commit 742b0bf501
2 changed files with 24 additions and 1 deletions

View file

@ -349,4 +349,27 @@ Help:
```
### UserScript
![UserScript](https://upload.deblan.org/u/2015-08/55cf69d1.png "UserScript")
```
// ==UserScript==
// @name Tranmission cli cmd
// @namespace t411
// @include http*://www.t411.io/torrents/*
// @version 1
// @grant none
// ==/UserScript==
$('.btn').each(function() {
var $btn = $(this);
var $parent = $btn.parent();
if ($btn.attr('href').indexOf('download') !== -1) {
var id = $btn.attr('href').split('=')[1];
$parent.append('<p>t411-console transmission:download ' + id + '</p>');
}
});
```

View file

@ -170,7 +170,7 @@ Usage: <comment>torrents:search</comment> <info>QUERY</info> [OPTIONS]
protected function formatBytes($size, $precision = 2)
{
$base = log($size, 1024);
$suffixes = array('', 'k', 'M', 'G', 'T');
$suffixes = array('', 'kB', 'MB', 'GB', 'TB');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
}