diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2015-06-28 11:18:53 +0100 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2015-06-28 11:18:53 +0100 |
commit | 291ba13a2eed0926c10332845f8185943443ebc9 (patch) | |
tree | f12891eefd1a30e61ae14eaa29a7df31076dcab5 | |
parent | 1b96751fb3b9d2fd01fc62483370f6ce58e9dc2c (diff) | |
download | mongo-edu-291ba13a2eed0926c10332845f8185943443ebc9.zip |
update
sd video quality fallback
version bump
-rw-r--r-- | lib/videos.js | 8 | ||||
-rw-r--r-- | package.json | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/videos.js b/lib/videos.js index caf97d3..dbdf862 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -163,7 +163,7 @@ var handleList = function handleList(list, tags) { }); }, - getVideos = function getVideos(item, nocc) { + getVideos = function getVideos(item, nocc, notAvailable) { if (handout) { return getHandouts(item); } @@ -173,6 +173,7 @@ var handleList = function handleList(list, tags) { size = info.size; stash = info; if (co) { downloadList.push({id: item, name: path.basename(info._filename)}); } + if (notAvailable) { console.log('i'.magenta + ' No HQ video available for ' + info.fulltitle.white.bold + ' trying default quality ...'); } console.log('i'.magenta + ' Downloading: ' + info._filename.cyan + ' > ' + item); bar = new ProgressBar('>'.green + ' ' + filesize(size) + ' [:bar] :percent :etas', { complete: '=', incomplete: ' ', width: 20, total: parseInt(size, 10) }); console.time('i'.magenta + ' ' + info._filename + '. Done in'); @@ -184,6 +185,11 @@ var handleList = function handleList(list, tags) { }); dl.on('error', function error(err) { + if (err.message.indexOf('requested format not available') !== -1) { + _.pull(opt, '--format=22'); + opt.push('--format=18'); + return getVideos(item, nocc, true); + } console.log(err.stack); }); diff --git a/package.json b/package.json index efd14e8..7f19735 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mongo-edu", "preferGlobal": true, - "version": "0.2.13", + "version": "0.2.14", "author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)", "description": "Select and download videos and handouts from university.mongodb.com courses", "main": "./mongo-edu", @@ -34,7 +34,7 @@ "colors": "~1.1.2", "easy-table": "~1.0.0", "filesize": "~3.1.2", - "glob": "~5.0.10", + "glob": "~5.0.12", "inquirer": "~0.8.5", "lodash": "~3.9.3", "mkdirp": "~0.5.1", @@ -46,7 +46,7 @@ "rimraf": "~2.4.0", "unzip": "~0.1.11", "which": "~1.1.1", - "yargs": "~3.12.0", + "yargs": "~3.13.0", "youtube-dl": "~1.10.5" }, "engines": { |