diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-12-27 17:02:30 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-12-27 17:02:30 +0300 |
commit | a06e102fdc715dd12944adfd8b5448b5e473274f (patch) | |
tree | 53a68cd22be1bd14be0a2d56e3d9b26b47bf8529 /bin | |
parent | 47f9551a01ac43fa1377eefe65e5428b1e9df14f (diff) |
cmd: --announce flag works for "create" and "download" too
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cmd.js | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -244,7 +244,7 @@ function runInfo (torrentId) { } function runCreate (input) { - createTorrent(input, function (err, torrent) { + createTorrent(input, argv, function (err, torrent) { if (err) return errorAndExit(err) if (argv.out) { fs.writeFileSync(argv.out, torrent) @@ -261,12 +261,10 @@ function runDownload (torrentId) { argv.out = process.cwd() } - client = new WebTorrent({ - blocklist: argv.blocklist - }) - .on('error', fatalError) + client = new WebTorrent({ blocklist: argv.blocklist }) + client.on('error', fatalError) - var torrent = client.add(torrentId, { path: argv.out }) + var torrent = client.add(torrentId, { path: argv.out, announce: argv.announce }) torrent.on('infoHash', function () { function updateMetadata () { @@ -471,14 +469,10 @@ function runSeed (input) { return } - client = new WebTorrent({ - blocklist: argv.blocklist - }) - .on('error', fatalError) - - client.seed(input, { announce: argv.announce }) + client = new WebTorrent({ blocklist: argv.blocklist }) + client.on('error', fatalError) - client.on('torrent', function (torrent) { + client.seed(input, { announce: argv.announce }, function (torrent) { if (argv.quiet) console.log(torrent.magnetURI) drawTorrent(torrent) }) |