diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2014-09-27 13:26:28 +0100 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2014-09-27 13:26:28 +0100 |
commit | 3933a61a27a8d19272322d8f18b8111d70740993 (patch) | |
tree | 68918f54ce3bb5a939185fd41185b1e5bdf6d0fc /lib | |
parent | 67309cacdee13279d07e2f38ea6435539ed13da3 (diff) | |
download | mongo-edu-3933a61a27a8d19272322d8f18b8111d70740993.zip |
print debug info for .getInfo with --verbose
Diffstat (limited to 'lib')
-rw-r--r-- | lib/videos.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/videos.js b/lib/videos.js index f569407..a71d4e3 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -19,7 +19,8 @@ var path = require('path'), mv = require('mv'), _ = require('lodash'); -var downloadPath = '', proxy = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, verbose = false; +var isDebug = /[debug]/, downloadPath = '', proxy = '', downloadList = [], + co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, verbose = false; function setOptions(argv) { @@ -239,6 +240,8 @@ module.exports = { youtubedl.getInfo(item, options, function(err, info) { + if (verbose && isDebug.test(err)) { console.log(err); } + items.push((!err)?{name: info.title + ' - ' + info.resolution, value: item, id: i}:{name: 'No info: ' + item, value: item, id: i}); count = count - 1; @@ -307,6 +310,8 @@ module.exports = { youtubedl.getInfo(opt.url, options, function(err, info) { + if (verbose && isDebug.test(err)) { console.log(err); } + if (info.length) { for (i = 0; i < info.length; i++) { item = 'https://www.youtube.com/watch?v=' + info[i].id; |