Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed `--remove` and `--no-quit`; replaced w/ inference. Solves #181. #184

Merged
merged 1 commit into from Nov 19, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Removed `--remove` and `--no-quit`; replaced with inference. Resolves…

… issue #181.
  • Loading branch information
chrisaljoudi committed Nov 17, 2014
commit 6d311005f9a72d788b65ead6372fba6abde74157
@@ -28,8 +28,6 @@ var argv = minimist(process.argv.slice(2), {
t: 'subtitles',
l: 'list',
i: 'index',
n: 'no-quit',
r: 'remove',
o: 'out',
q: 'quiet',
h: 'help',
@@ -43,8 +41,6 @@ var argv = minimist(process.argv.slice(2), {
'vlc',
'xbmc',
'list',
'no-quit',
'remove',
'quiet',
'help',
'version'
@@ -56,7 +52,7 @@ var argv = minimist(process.argv.slice(2), {

if (argv.version) {
console.log(require('../package.json').version)
process.exit(0)
done()
}

var torrentId = argv._[0]
@@ -95,16 +91,14 @@ if (argv.help || !torrentId) {
-p, --port [number] change the http port [default: 9000]
-b, --blocklist [path] use the specified blocklist
-t, --subtitles [file] load subtitles file
-n, --no-quit do not quit webtorrent on vlc exit
-r, --remove remove downloaded files on exit
-q, --quiet print nothing to stdout
-v, --version print the current version
Please report bugs! https://github.com/feross/webtorrent/issues
*/}.toString().split(/\n/).slice(1, -1).join('\n'))
process.exit(0)
done()
}

if (process.env.DEBUG) {
@@ -146,7 +140,7 @@ var client = new WebTorrent({
})
.on('error', errorAndExit)

if (argv.remove) {
if (!argv.out) { // If no output file has been specified
process.on('SIGINT', remove)
process.on('SIGTERM', remove)
}
@@ -175,16 +169,23 @@ torrent.on('infoHash', function () {
}
})

var filename, swarm, wires, server
var filename, swarm, wires, server, serving

if (argv.list) torrent.once('ready', onReady)
else {
server = torrent.createServer()
server.listen(argv.port, function () {
if (torrent.ready) onReady()
else torrent.once('ready', onReady)
}).once('connection', function () {
serving = true
})
}
function done () {
if (!serving) {
process.exit(0)
}
}

function onReady () {
filename = torrent.name
@@ -203,7 +204,7 @@ function onReady () {
torrent.files.forEach(function (file, i) {
clivas.line('{3+bold:' + i + '} : {magenta:' + file.name + '}')
})
process.exit(0)
done()
}

torrent.on('verifying', function (data) {
@@ -223,18 +224,7 @@ function onReady () {
}, 0)
clivas.line('torrent downloaded {green:successfully} from {bold:'+numActiveWires+'/'+torrent.swarm.wires.length+'} {green:peers} in {bold:'+getRuntime()+'s}!')
}

if (argv.remove) {
remove(maybeExit)
} else {
maybeExit()
}

function maybeExit () {
if (!server) {
process.exit(0)
}
}
done()
})

var cmd, player
@@ -284,7 +274,7 @@ function onReady () {
if (cmd) {
player = cp.exec(cmd, errorAndExit)
.on('exit', function () {
if (!argv['no-quit']) process.exit(0)
done()
})
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.