From 8cf42a316711fd98600fad841f1fea02550ff697 Mon Sep 17 00:00:00 2001 From: opfl Date: Sun, 2 Nov 2014 13:37:24 -0800 Subject: [PATCH 1/4] Added command to override default tmp path --- bin/cmd.js | 4 +++- index.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/cmd.js b/bin/cmd.js index 4c7a19d9..af8eb80f 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -30,6 +30,7 @@ var argv = minimist(process.argv.slice(2), { i: 'index', n: 'no-quit', r: 'remove', + d: 'default', q: 'quiet', h: 'help', v: 'version' @@ -94,6 +95,7 @@ if (argv.help || !torrentId) { -i, --index stream a particular file from torrnet (by index) -n, --no-quit do not quit webtorrent on vlc exit -r, --remove remove downloaded files on exit + -d, --default [path] overrides the default tmp directory -q, --quiet silence stdout -h, --help display this help message -v, --version print the current version @@ -154,7 +156,7 @@ function remove (cb) { client.destroy(cb) } -var torrent = client.add(torrentId) +var torrent = client.add(torrentId, (argv.default ? { tmp: argv.default } : {})) torrent.on('infoHash', function () { function updateMetadata () { diff --git a/index.js b/index.js index 3ad617b1..e8404cdc 100644 --- a/index.js +++ b/index.js @@ -144,6 +144,8 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { opts.client = self opts.storage = opts.storage || self.storage + if(opts.tmp) opts.storageOpts = { tmp: opts.tmp }; + var torrent = new Torrent(torrentId, extend({ client: self }, opts)) self.torrents.push(torrent) From ec54ffff77ccdc213de132476de26795ea4ac47f Mon Sep 17 00:00:00 2001 From: opfl Date: Sun, 2 Nov 2014 14:08:40 -0800 Subject: [PATCH 2/4] Changed command name to download --- bin/cmd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index af8eb80f..24e130d9 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -30,7 +30,7 @@ var argv = minimist(process.argv.slice(2), { i: 'index', n: 'no-quit', r: 'remove', - d: 'default', + d: 'download', q: 'quiet', h: 'help', v: 'version' @@ -95,7 +95,7 @@ if (argv.help || !torrentId) { -i, --index stream a particular file from torrnet (by index) -n, --no-quit do not quit webtorrent on vlc exit -r, --remove remove downloaded files on exit - -d, --default [path] overrides the default tmp directory + -d, --download [path] overrides the default tmp directory -q, --quiet silence stdout -h, --help display this help message -v, --version print the current version From 24bb2fde23343bc55f87e6f7dbfc3bec70329db9 Mon Sep 17 00:00:00 2001 From: opfl Date: Sun, 2 Nov 2014 14:16:59 -0800 Subject: [PATCH 3/4] Changed command name to download --- bin/cmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cmd.js b/bin/cmd.js index 24e130d9..fcc86126 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -156,7 +156,7 @@ function remove (cb) { client.destroy(cb) } -var torrent = client.add(torrentId, (argv.default ? { tmp: argv.default } : {})) +var torrent = client.add(torrentId, (argv.download ? { tmp: argv.download } : {})) torrent.on('infoHash', function () { function updateMetadata () { From d29808e4e9e953d84978f7f3c2900d82ac7b41b8 Mon Sep 17 00:00:00 2001 From: opfl Date: Sun, 2 Nov 2014 15:42:14 -0800 Subject: [PATCH 4/4] changed command to out --- bin/cmd.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index fcc86126..e52b2572 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -30,7 +30,7 @@ var argv = minimist(process.argv.slice(2), { i: 'index', n: 'no-quit', r: 'remove', - d: 'download', + o: 'out', q: 'quiet', h: 'help', v: 'version' @@ -95,7 +95,7 @@ if (argv.help || !torrentId) { -i, --index stream a particular file from torrnet (by index) -n, --no-quit do not quit webtorrent on vlc exit -r, --remove remove downloaded files on exit - -d, --download [path] overrides the default tmp directory + -o, --out [path] overrides the default tmp directory -q, --quiet silence stdout -h, --help display this help message -v, --version print the current version @@ -156,7 +156,7 @@ function remove (cb) { client.destroy(cb) } -var torrent = client.add(torrentId, (argv.download ? { tmp: argv.download } : {})) +var torrent = client.add(torrentId, (argv.out ? { tmp: argv.out } : {})) torrent.on('infoHash', function () { function updateMetadata () {