mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-24 00:38:05 +00:00
Use red color when printing error messages
This commit is contained in:
parent
967897fd22
commit
4e1582f372
1 changed files with 12 additions and 0 deletions
|
@ -246,6 +246,18 @@ class FileDownloader(object):
|
||||||
warning_message=u'%s %s' % (_msg_header,message)
|
warning_message=u'%s %s' % (_msg_header,message)
|
||||||
self.to_stderr(warning_message)
|
self.to_stderr(warning_message)
|
||||||
|
|
||||||
|
def report_error(self, message, tb=None):
|
||||||
|
'''
|
||||||
|
Do the same as trouble, but prefixes the message with 'ERROR:', colored
|
||||||
|
in red if stderr is a tty file.
|
||||||
|
'''
|
||||||
|
if sys.stderr.isatty():
|
||||||
|
_msg_header = u'\033[0;31mERROR:\033[0m'
|
||||||
|
else:
|
||||||
|
_msg_header = u'ERROR:'
|
||||||
|
error_message = u'%s %s' % (_msg_header, message)
|
||||||
|
self.trouble(error_message, tb)
|
||||||
|
|
||||||
def slow_down(self, start_time, byte_counter):
|
def slow_down(self, start_time, byte_counter):
|
||||||
"""Sleep if the download speed is over the rate limit."""
|
"""Sleep if the download speed is over the rate limit."""
|
||||||
rate_limit = self.params.get('ratelimit', None)
|
rate_limit = self.params.get('ratelimit', None)
|
||||||
|
|
Loading…
Reference in a new issue