Update YoutubeDL.py

This commit is contained in:
Sergey M 2017-06-03 19:11:32 +07:00 committed by GitHub
parent a8c92a9beb
commit 43b4a71b89

View File

@ -498,10 +498,11 @@ class YoutubeDL(object):
def to_console_title(self, message): def to_console_title(self, message):
if not self.params.get('consoletitle', False): if not self.params.get('consoletitle', False):
return return
if compat_os_name == 'nt' and ctypes.windll.kernel32.GetConsoleWindow(): if compat_os_name == 'nt':
# c_wchar_p() might not be necessary if `message` is if ctypes.windll.kernel32.GetConsoleWindow():
# already of type unicode() # c_wchar_p() might not be necessary if `message` is
ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message)) # already of type unicode()
ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message))
elif 'TERM' in os.environ: elif 'TERM' in os.environ:
self._write_string('\033]0;%s\007' % message, self._screen_file) self._write_string('\033]0;%s\007' % message, self._screen_file)