summaryrefslogtreecommitdiff
path: root/lib/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/videos.js')
-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) {