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 /lib | |
parent | 1b96751fb3b9d2fd01fc62483370f6ce58e9dc2c (diff) | |
download | mongo-edu-291ba13a2eed0926c10332845f8185943443ebc9.zip |
update
sd video quality fallback
version bump
Diffstat (limited to 'lib')
-rw-r--r-- | lib/videos.js | 8 |
1 files changed, 7 insertions, 1 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); }); |