diff options
author | Josip Janžić <josip.janzic@gmail.com> | 2015-06-14 13:26:07 +0300 |
---|---|---|
committer | Josip Janžić <josip.janzic@gmail.com> | 2015-06-14 13:26:07 +0300 |
commit | ae5161aa42fc64c044193201fe70c8bdf4fe187b (patch) | |
tree | 84b177bf62764f6d8de2abe44af620b03502cb92 /bin | |
parent | 7c6e151ad02dc4150df210af4cc3f7e34d71b988 (diff) |
added --verbose option to show piece info bars
closes #296
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cmd.js | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -54,7 +54,8 @@ var argv = minimist(process.argv.slice(2), { 'select', 'quiet', 'help', - 'version' + 'version', + 'verbose' ], default: { port: 8000 @@ -142,6 +143,7 @@ function runHelp () { -t, --subtitles [file] load subtitles file -q, --quiet don't show UI on stdout -v, --version print the current version + --verbose show piece progress bars Please report bugs! https://github.com/feross/webtorrent/issues @@ -519,21 +521,25 @@ function drawTorrent (torrent) { clivas.line('{80:}') linesRemaining -= 5 - var pieces = torrent.storage.pieces - for (var i = 0; i < pieces.length; i++) { - var piece = pieces[i] - if (piece.verified || (piece.blocksWritten === 0 && !piece.blocks[0])) { - continue - } - var bar = '' - for (var j = 0; j < piece.blocks.length; j++) { - bar += piece.blocks[j] ? (piece.blocks[j] === 1 ? '{blue:█}' : '{green:█}') : '{red:█}' + if (argv.verbose) { + + var pieces = torrent.storage.pieces + for (var i = 0; i < pieces.length; i++) { + var piece = pieces[i] + if (piece.verified || (piece.blocksWritten === 0 && !piece.blocks[0])) { + continue + } + var bar = '' + for (var j = 0; j < piece.blocks.length; j++) { + bar += piece.blocks[j] ? (piece.blocks[j] === 1 ? '{blue:█}' : '{green:█}') : '{red:█}' + } + clivas.line('{4+cyan:' + i + '} ' + bar) + linesRemaining -= 1 } - clivas.line('{4+cyan:' + i + '} ' + bar) + clivas.line('{80:}') linesRemaining -= 1 + } - clivas.line('{80:}') - linesRemaining -= 1 torrent.swarm.wires.every(function (wire) { var progress = '?' |