mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-30 22:03:00 +08:00
Add --no-warnings option (Fixes #2630)
This commit is contained in:
parent
34cbc7ee8d
commit
ad8915b729
@ -94,6 +94,7 @@ class YoutubeDL(object):
|
|||||||
usenetrc: Use netrc for authentication instead.
|
usenetrc: Use netrc for authentication instead.
|
||||||
verbose: Print additional info to stdout.
|
verbose: Print additional info to stdout.
|
||||||
quiet: Do not print messages to stdout.
|
quiet: Do not print messages to stdout.
|
||||||
|
no_warnings: Do not print out anything for warnings.
|
||||||
forceurl: Force printing final URL.
|
forceurl: Force printing final URL.
|
||||||
forcetitle: Force printing title.
|
forcetitle: Force printing title.
|
||||||
forceid: Force printing ID.
|
forceid: Force printing ID.
|
||||||
@ -376,6 +377,8 @@ class YoutubeDL(object):
|
|||||||
if self.params.get('logger') is not None:
|
if self.params.get('logger') is not None:
|
||||||
self.params['logger'].warning(message)
|
self.params['logger'].warning(message)
|
||||||
else:
|
else:
|
||||||
|
if self.params.get('no_warnings'):
|
||||||
|
return
|
||||||
if self._err_file.isatty() and os.name != 'nt':
|
if self._err_file.isatty() and os.name != 'nt':
|
||||||
_msg_header = '\033[0;33mWARNING:\033[0m'
|
_msg_header = '\033[0;33mWARNING:\033[0m'
|
||||||
else:
|
else:
|
||||||
|
@ -364,6 +364,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
|
|
||||||
verbosity.add_option('-q', '--quiet',
|
verbosity.add_option('-q', '--quiet',
|
||||||
action='store_true', dest='quiet', help='activates quiet mode', default=False)
|
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',
|
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)
|
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',
|
verbosity.add_option('--skip-download',
|
||||||
@ -708,6 +712,7 @@ def _real_main(argv=None):
|
|||||||
'password': opts.password,
|
'password': opts.password,
|
||||||
'videopassword': opts.videopassword,
|
'videopassword': opts.videopassword,
|
||||||
'quiet': (opts.quiet or any_printing),
|
'quiet': (opts.quiet or any_printing),
|
||||||
|
'no_warnings': opts.no_warnings,
|
||||||
'forceurl': opts.geturl,
|
'forceurl': opts.geturl,
|
||||||
'forcetitle': opts.gettitle,
|
'forcetitle': opts.gettitle,
|
||||||
'forceid': opts.getid,
|
'forceid': opts.getid,
|
||||||
|
Loading…
Reference in New Issue
Block a user