aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-10 04:22:10 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-10 04:22:10 +0100
commit7e5db8c930e5f154287f98c6c0da90fffd2ede4f (patch)
tree1363cfbbd15c8ccad3250eedc33ca01c3b4eac61 /youtube_dl/YoutubeDL.py
parentf7a211dcc8d86fe5a4d25f4d209ffb3efc05bdfc (diff)
downloadyoutube-dl-7e5db8c930e5f154287f98c6c0da90fffd2ede4f.tar.xz
[options] Add --no-color
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index dda222fee..e2ec55c90 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -233,6 +233,7 @@ class YoutubeDL(object):
If it returns a message, the video is ignored.
If it returns None, the video is downloaded.
match_filter_func in utils.py is one example for this.
+ no_color: Do not emit color codes in output.
The following parameters are not used by YoutubeDL itself, they are used by
@@ -490,7 +491,7 @@ class YoutubeDL(object):
else:
if self.params.get('no_warnings'):
return
- if self._err_file.isatty() and os.name != 'nt':
+ if not self.params.get('no_color') and self._err_file.isatty() and os.name != 'nt':
_msg_header = '\033[0;33mWARNING:\033[0m'
else:
_msg_header = 'WARNING:'
@@ -502,7 +503,7 @@ class YoutubeDL(object):
Do the same as trouble, but prefixes the message with 'ERROR:', colored
in red if stderr is a tty file.
'''
- if self._err_file.isatty() and os.name != 'nt':
+ if not self.params.get('no_color') and self._err_file.isatty() and os.name != 'nt':
_msg_header = '\033[0;31mERROR:\033[0m'
else:
_msg_header = 'ERROR:'