Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosip Janžić <josip.janzic@gmail.com>2015-06-14 13:26:07 +0300
committerJosip Janžić <josip.janzic@gmail.com>2015-06-14 13:26:07 +0300
commitae5161aa42fc64c044193201fe70c8bdf4fe187b (patch)
tree84b177bf62764f6d8de2abe44af620b03502cb92 /bin/cmd.js
parent7c6e151ad02dc4150df210af4cc3f7e34d71b988 (diff)
added --verbose option to show piece info bars
closes #296
Diffstat (limited to 'bin/cmd.js')
-rwxr-xr-xbin/cmd.js32
1 files changed, 19 insertions, 13 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 7c82a9a..46846ef 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -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 = '?'