1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-22 23:23:04 +08:00

Allow --console-title when --quiet is given (Fixes #1783)

This commit is contained in:
Philipp Hagemeister 2013-11-17 21:12:50 +01:00
parent bdde425cbe
commit 749febf4d1

View File

@ -211,19 +211,19 @@ class YoutubeDL(object):
# already of type unicode() # already of type unicode()
ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message)) ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message))
elif 'TERM' in os.environ: elif 'TERM' in os.environ:
self.to_screen('\033]0;%s\007' % message, skip_eol=True) write_string(u'\033]0;%s\007' % message, self._screen_file)
def save_console_title(self): def save_console_title(self):
if not self.params.get('consoletitle', False): if not self.params.get('consoletitle', False):
return return
if 'TERM' in os.environ: if 'TERM' in os.environ:
self.to_screen('\033[22t') write_string(u'\033[22t', self._screen_file)
def restore_console_title(self): def restore_console_title(self):
if not self.params.get('consoletitle', False): if not self.params.get('consoletitle', False):
return return
if 'TERM' in os.environ: if 'TERM' in os.environ:
self.to_screen('\033[23t') write_string(u'\033[23t', self._screen_file)
def __enter__(self): def __enter__(self):
self.save_console_title() self.save_console_title()