From 3a3d661499e79490b906cfe44ad0bee7c3d07afd Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 22 Nov 2014 02:37:54 +0100 Subject: display pieces that are in progress --- bin/cmd.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'bin') diff --git a/bin/cmd.js b/bin/cmd.js index 8c8d1bc..b7bb649 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -366,6 +366,23 @@ function onReady () { clivas.line('{80:}') linesremaining -= 8 + var pieces = torrent.storage.pieces + var piecesBar = [] + for(var i = 0; i < pieces.length; i++) { + var piece = pieces[i] + if (piece.verified || piece.blocksWritten === 0) { + continue; + } + var bar = '' + for(var j = 0; j < piece.blocks.length; j++) { + bar += piece.blocks[j] ? '{green:█}' : '{red:█}'; + } + clivas.line('{4+cyan:' + i + '} ' + bar); + linesremaining -= 1 + } + clivas.line('{80:}') + linesremaining -= 1 + wires.every(function (wire) { var tags = [] if (wire.peerChoking) tags.push('choked') -- cgit v1.2.3