From 3933a61a27a8d19272322d8f18b8111d70740993 Mon Sep 17 00:00:00 2001 From: przemyslawpluta Date: Sat, 27 Sep 2014 13:26:28 +0100 Subject: print debug info for .getInfo with --verbose --- lib/videos.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') 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; -- cgit v1.2.3