summaryrefslogtreecommitdiff
path: root/mongo-edu.js
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2014-04-26 18:37:31 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2014-04-26 18:37:31 +0100
commite730aeda71d73dbe514e534251c2fed92bc40d7c (patch)
treefefb8792e92cdcc37943ed96673fad53a0353204 /mongo-edu.js
parentd0267d857491eaff02a9cd451a5710cde9d229b4 (diff)
downloadmongo-edu-e730aeda71d73dbe514e534251c2fed92bc40d7c.zip
search through courseware
dump video lists cleanup
Diffstat (limited to 'mongo-edu.js')
-rw-r--r--mongo-edu.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/mongo-edu.js b/mongo-edu.js
index 56bc8b7..da526bd 100644
--- a/mongo-edu.js
+++ b/mongo-edu.js
@@ -15,6 +15,8 @@ var mdbvideos = require('./lib/login'),
.usage('Usage: $0 [options]')
.describe('d', 'download path').describe('u', 'email address')
.describe('h', 'switch from videos (default) to handouts').boolean('h')
+ .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')
@@ -36,7 +38,7 @@ exports.create = function start() {
function run(profile) {
- inquirer.prompt(profile, function promt(answers) {
+ inquirer.prompt(profile, function prompt(answers) {
var list = [{ type: 'list', name: 'url', message: '', choices: [] }], classes = list,
@@ -49,6 +51,7 @@ exports.create = function start() {
mdbvideos.init(answers, argv, function get(err, data) {
if (err !== null) { throw err; }
+
if (data.length) {
classes[0].message = 'Found ' + data.length + ' Course'+ ((data.length > 1)? 's' : '') + '. Select:';
@@ -74,16 +77,21 @@ exports.create = function start() {
return currentVideos();
+ } else {
+ if (pass) { return console.log('[' + 'i'.red + '] Looks like the course is not yet available or has already ended. ' +
+ lookFor + ' list is not available.\n\nCheck the start/end date for selected course.\n'); }
}
- return console.log('[' + 'i'.red + '] Unable to locate any ' + lookFor.toLowerCase() + ' lists in the wiki. Is course available / ' +
- lookFor.toLowerCase() + ' list present in the wiki?');
+ return console.log('[' + 'i'.red + '] Unable to locate any ' + lookFor.toLowerCase() + ' lists in the wiki. Is ' +
+ lookFor.toLowerCase() + ' list present in the wiki?' +
+ (lookFor === 'Videos') ? ' Try to add ' + '--cw'.green + ' to switch and search on courseware instead.' : '');
});
});
}
function currentVideos() {
+
inquirer.prompt(list, function prompt(answers) {
mdbvideos.listVideos(answers, argv, function get(err, data, pass) {