summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2014-09-25 22:04:04 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2014-09-25 22:04:04 +0100
commit4662c967a3001909f603dec9724b45d1a766ee61 (patch)
tree056af8f931a86de89f41c4145c03f832a7d8fd5c /lib
parent0b2917b0b9297ce4396c338c85f9a6866e60b16e (diff)
downloadmongo-edu-4662c967a3001909f603dec9724b45d1a766ee61.zip
update
add proxy support add debug info print through `--verbose` flag version bump cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/videos.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/videos.js b/lib/videos.js
index 17a9a41..f569407 100644
--- a/lib/videos.js
+++ b/lib/videos.js
@@ -19,19 +19,21 @@ var path = require('path'),
mv = require('mv'),
_ = require('lodash');
-var downloadPath = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false;
+var downloadPath = '', proxy = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, verbose = false;
function setOptions(argv) {
'use strict';
downloadPath = argv.d;
+ proxy = argv.proxy;
if (argv.ncc) { ncc = true; }
if (argv.h) { handout = true; }
if (argv.cc) { cc = true; }
if (argv.uz) { uz = true; }
if (argv.hq) { hq = true; }
if (argv.co) { co = true; }
+ if (argv.verbose) { verbose = true; }
}
function rename(downloadPath, item, id, count, pass) {
@@ -62,6 +64,10 @@ var handleList = function handleList(list, tags) {
if (cc) { opt = opt.concat(['--write-sub', '--srt-lang=en']); }
+ if (verbose) { opt = opt.concat(['--verbose']); }
+
+ if (proxy) { opt = opt.concat(['--proxy', proxy]); }
+
var getHandouts = function getHandouts(item) {
var name = path.basename(item), bar, dounloadFile, dlh, left, extname, unzipFile, progressSoFar = -1, hold = 0,
@@ -206,6 +212,10 @@ module.exports = {
var bar = new ProgressBar('>'.magenta + ' Collecting [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: opt.length }),
options = (!ncc) ? [] : ['--no-check-certificate'];
+ if (verbose) { options = options.concat(['--verbose']); }
+
+ if (proxy) { options = options.concat(['--proxy', proxy]); }
+
var isFinished = function isFinished(count, items) {
if (count === 0) {
@@ -291,6 +301,10 @@ module.exports = {
var options = (!ncc) ? [] : ['--no-check-certificate'], items = [], i, item;
+ if (verbose) { options = options.concat(['--verbose']); }
+
+ if (proxy) { options = options.concat(['--proxy', proxy]); }
+
youtubedl.getInfo(opt.url, options, function(err, info) {
if (info.length) {