summaryrefslogtreecommitdiff
path: root/lib/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/videos.js')
-rw-r--r--lib/videos.js16
1 files changed, 11 insertions, 5 deletions
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);