diff --git a/README.md b/README.md index e8f38df..81d58fa 100644 --- a/README.md +++ b/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('

t411-console transmission:download ' + id + '

'); + } +}); +``` diff --git a/src/Console/Command/TorrentsSearchCommand.php b/src/Console/Command/TorrentsSearchCommand.php index bed6358..6360895 100644 --- a/src/Console/Command/TorrentsSearchCommand.php +++ b/src/Console/Command/TorrentsSearchCommand.php @@ -170,7 +170,7 @@ Usage: torrents:search QUERY [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)]; }