UserScript + Torrents size
This commit is contained in:
parent
59154341ea
commit
742b0bf501
23
README.md
23
README.md
|
@ -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>');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
|
|
@ -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)];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue