summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lib/videos.js15
-rw-r--r--mongo-edu.js3
-rw-r--r--package.json2
4 files changed, 13 insertions, 8 deletions
diff --git a/README.md b/README.md
index 8aecad3..d5ac770 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ Options:
-h switch from videos (default) to handouts
--cw switch from wiki video lists (default) to courseware
--cwd same as --cw and dumps list of videos to file in -d
+ --co dump course order list to file in -d
--cc get closed captions
--hq get high quality videos
--ncc no check certificate for py3.x < py3.4.x
diff --git a/lib/videos.js b/lib/videos.js
index f64d330..d4ce7b4 100644
--- a/lib/videos.js
+++ b/lib/videos.js
@@ -18,7 +18,7 @@ var path = require('path'),
execFile = require('child_process').execFile,
_ = require('lodash');
-var downloadPath = '', downloadList = [], ncc = false, handout = false, cc = false, uz = false, hq = false, isWin = /^win/.test(process.platform);
+var downloadPath = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, isWin = /^win/.test(process.platform);
var setOptions = function setOptions(argv) {
@@ -30,6 +30,7 @@ var setOptions = function setOptions(argv) {
if (argv.cc) { cc = true; }
if (argv.uz) { uz = true; }
if (argv.hq) { hq = true; }
+ if (argv.co) { co = true; }
};
var handleList = function handleList(list) {
@@ -124,7 +125,7 @@ var handleList = function handleList(list) {
var dl = youtubedl.download(item, downloadPath, opt), bar;
dl.on('download', function download(data) {
- downloadList.push(path.basename(data.filename));
+ if (co) { downloadList.push(path.basename(data.filename)); }
console.log('[' + 'i'.magenta + '] Downloading: ' + data.filename.cyan + ' > ' + item);
bar = new ProgressBar('[' + '>'.green + '] ' + data.size + ' [:bar] :percent :etas', { complete: '=', incomplete: ' ', width: 20, total: 100.0 });
});
@@ -154,10 +155,14 @@ var handleList = function handleList(list) {
if (currentList.length) { return getVideos(currentList.shift()); }
- fs.writeFile(downloadPath + 'Course_Order.txt', downloadList.join((!isWin) ? '\n' : '\r\n'), function write(err) {
- if (err !== null) { console.log(err.stack); }
+ if (co) {
+ fs.writeFile(downloadPath + 'Course_Order.txt', downloadList.join((!isWin) ? '\n' : '\r\n'), function write(err) {
+ if (err !== null) { console.log(err.stack); }
+ console.log('[ Finished ]'.green);
+ });
+ } else {
console.log('[ Finished ]'.green);
- });
+ }
};
diff --git a/mongo-edu.js b/mongo-edu.js
index 5afe4f4..f6dc0ca 100644
--- a/mongo-edu.js
+++ b/mongo-edu.js
@@ -22,6 +22,7 @@ var mdbvideos = require('./lib/login'),
.describe('hq', 'get high quality videos').boolean('hq')
.describe('ncc', 'no check certificate').boolean('ncc')
.describe('uz', 'unzip handout files').boolean('uz')
+ .describe('co', 'dump course order list').boolean('co')
.demand('d');
exports.create = function start() {
@@ -116,9 +117,7 @@ exports.create = function start() {
check[0].choices = data;
return inquirer.prompt(check, function prompt(answers) {
-
videoHandler.download(answers, data, argv);
-
});
}
diff --git a/package.json b/package.json
index a00269f..f422e38 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "mongo-edu",
"preferGlobal": true,
- "version": "0.1.20",
+ "version": "0.1.21",
"author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)",
"description": "Select and download videos and handouts from university.mongodb.com courses",
"main": "./mongo-edu",