summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.resume/resume.js3
-rw-r--r--lib/videos.js16
-rw-r--r--package.json2
3 files changed, 15 insertions, 6 deletions
diff --git a/.resume/resume.js b/.resume/resume.js
index 385e356..6d6fa6b 100644
--- a/.resume/resume.js
+++ b/.resume/resume.js
@@ -305,6 +305,9 @@ ytdl.getSubs = function(url, options, callback) {
if (options.lang) {
args.push('--sub-lang=' + options.lang);
}
+ if (!options.warrning) {
+ args.push('--no-warnings');
+ }
call(url, args, [], { cwd: options.cwd }, function(err, data) {
if (err) return callback(err);
diff --git a/lib/videos.js b/lib/videos.js
index 0fe77b4..e737cab 100644
--- a/lib/videos.js
+++ b/lib/videos.js
@@ -152,17 +152,23 @@ var handleList = function handleList(list, tags) {
},
- getSubtitles = function getSubtitles(item, left, currentList, tags) {
+ getSubtitles = function getSubtitles(item, left, currentList, tags, switchAuto) {
if (!cc) {
if (left) { console.log('i'.magenta + ' ' + left); }
return handleList(currentList, tags);
}
- youtubedl.getSubs(item, { auto: true, all: false, lang: 'en', cwd: downloadPath }, function getSubs(err) {
- if (err !== null) {
- console.log('i'.red + ' Unable to download subtitles.');
+ var subOptions = {auto: false, all: false, lang: 'en', cwd: downloadPath}, extraInfo = '';
+
+ if (switchAuto) { subOptions.auto = true; }
+
+ youtubedl.getSubs(item, subOptions, function getSubs(err, files) {
+ if (!files.length || err) {
+ if (!subOptions.auto) { extraInfo = ' Switching to automated subtitles.'; }
+ console.log('i'.red + ' Unable to download subtitles.' + extraInfo);
+ if (extraInfo !== '') { return getSubtitles(item, left, currentList, tags, true); }
} else {
- console.log('i'.magenta + ' Subtitles downloaded.');
+ console.log('i'.magenta + ' Subtitles ' + files.toString().cyan + ' downloaded.');
}
if (left) { console.log('i'.magenta + ' ' + left); }
handleList(currentList, tags);
diff --git a/package.json b/package.json
index 972ad06..804ce18 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "mongo-edu",
"preferGlobal": true,
- "version": "0.2.52",
+ "version": "0.2.53",
"author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)",
"description": "Select and download videos and handouts from university.mongodb.com courses",
"main": "./mongo-edu",