summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2014-09-27 23:14:36 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2014-09-27 23:14:36 +0100
commit9945c1051913e889bed8503dad04d5c8b1249cbd (patch)
tree875f3ff813d9373451bc07de981e26f52b26542a /lib
parentaf85ef512625fdc0c4709c1bcbbca12dfbc6e606 (diff)
downloadmongo-edu-9945c1051913e889bed8503dad04d5c8b1249cbd.zip
cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/login.js3
-rw-r--r--lib/options.js40
-rw-r--r--lib/videos.js3
3 files changed, 46 insertions, 0 deletions
diff --git a/lib/login.js b/lib/login.js
index 01ecd6d..9194dba 100644
--- a/lib/login.js
+++ b/lib/login.js
@@ -196,6 +196,9 @@ module.exports = {
},
checkProxy: function checkProxy(target, callback) {
+
+ 'use strict';
+
request(target, function get(err, response) {
if (err !== null) { return callback(err); }
if (response.statusCode === 200) {
diff --git a/lib/options.js b/lib/options.js
new file mode 100644
index 0000000..42e2616
--- /dev/null
+++ b/lib/options.js
@@ -0,0 +1,40 @@
+/*
+ * mongo-edu
+ *
+ * Copyright (c) 2014 Przemyslaw Pluta
+ * Licensed under the MIT license.
+ * https://github.com/przemyslawpluta/mongo-edu/blob/master/LICENSE
+ */
+
+var yargs = require('yargs')
+ .usage('Usage: $0 [options]')
+ .describe('d', 'download path').describe('u', 'email address')
+ .describe('h', 'switch from videos (default) to handouts').boolean('h')
+ .describe('py', 'py switch').describe('py', 'switch to point to Python')
+ .describe('proxy', 'pass proxy').describe('proxy', 'pass proxy switch for video download')
+ .describe('test', 'proxy test').describe('test', 'use with --proxy to test if usable')
+ .describe('cw', 'switch from wiki\'s video lists (default) to courseware').boolean('cw')
+ .describe('cwd', 'same as --cw and dumps list of videos to file in -d').boolean('cwd')
+ .describe('cc', 'get closed captions').boolean('cc')
+ .describe('hq', 'get high quality videos').boolean('hq')
+ .describe('ncc', 'no check certificate').boolean('ncc')
+ .describe('uz', 'unzip handout files').boolean('uz')
+ .describe('co', 'sequence video files in order of the courseware').boolean('co')
+ .describe('verbose', 'print debug information').boolean('verbose')
+ .example('$0 -d your_download_path', 'download videos from wiki')
+ .example('$0 -d your_download_path -u your_user_name --cw --hq --cc', 'download high quality videos from courseware with closed captions')
+ .example('$0 -d your_download_path -h --uz', 'download and unzip handouts')
+ .example('$0 -d your_download_path --cw --verbose', 'download videos from courseware and print debug info')
+ .example('$0 -d your_download_path --cw --proxy http://proxy_ip_address:proxy_port_number', 'download videos from courseware via proxy tunnel')
+ .example('$0 -d your_download_path --proxy http://proxy_ip_address:proxy_port_number --test', 'test proxy and download video via proxy tunnel')
+ .demand('d');
+
+module.exports = (function init() {
+
+ 'use strict';
+
+ return {
+ build: function build() { return yargs; },
+ };
+
+}());
diff --git a/lib/videos.js b/lib/videos.js
index bf8973e..c5d4806 100644
--- a/lib/videos.js
+++ b/lib/videos.js
@@ -328,6 +328,9 @@ module.exports = {
},
checkProxyDownload: function checkProxyDownload(argv) {
+
+ 'use strict';
+
setOptions(argv);
var video = 'https://youtu.be/nm20j_x9Ol8', opt = { all: undefined, cancel: undefined };
if (typeof argv.test === 'string') { video = argv.test; }