diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-03-26 00:43:46 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-03-26 00:43:46 +0100 |
commit | ad8915b7297992947e1ddeab80c42e9f64571e9b (patch) | |
tree | 200b8963e56dd0da38d57d7ad311cd8e83c4ac31 | |
parent | 34cbc7ee8db36e85d2021455f468c5dc2da616b8 (diff) |
Add --no-warnings option (Fixes #2630)
-rw-r--r-- | youtube_dl/YoutubeDL.py | 3 | ||||
-rw-r--r-- | youtube_dl/__init__.py | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index d18d6dd00..ae0ec49f8 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -94,6 +94,7 @@ class YoutubeDL(object): usenetrc: Use netrc for authentication instead. verbose: Print additional info to stdout. quiet: Do not print messages to stdout. + no_warnings: Do not print out anything for warnings. forceurl: Force printing final URL. forcetitle: Force printing title. forceid: Force printing ID. @@ -376,6 +377,8 @@ class YoutubeDL(object): if self.params.get('logger') is not None: self.params['logger'].warning(message) else: + if self.params.get('no_warnings'): + return if self._err_file.isatty() and os.name != 'nt': _msg_header = '\033[0;33mWARNING:\033[0m' else: diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 056e94457..6af4b8aee 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -364,6 +364,10 @@ def parseOpts(overrideArguments=None): verbosity.add_option('-q', '--quiet', action='store_true', dest='quiet', help='activates quiet mode', default=False) + verbosity.add_option( + '--no-warnings', + dest='no_warnings', action='store_true', default=False, + help='Ignore warnings') verbosity.add_option('-s', '--simulate', action='store_true', dest='simulate', help='do not download the video and do not write anything to disk', default=False) verbosity.add_option('--skip-download', @@ -708,6 +712,7 @@ def _real_main(argv=None): 'password': opts.password, 'videopassword': opts.videopassword, 'quiet': (opts.quiet or any_printing), + 'no_warnings': opts.no_warnings, 'forceurl': opts.geturl, 'forcetitle': opts.gettitle, 'forceid': opts.getid, |