|
|
@ -24,9 +24,6 @@ import time
|
|
|
|
import tokenize
|
|
|
|
import tokenize
|
|
|
|
import traceback
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
|
|
|
|
if os.name == 'nt':
|
|
|
|
|
|
|
|
import ctypes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from .compat import (
|
|
|
|
from .compat import (
|
|
|
|
compat_basestring,
|
|
|
|
compat_basestring,
|
|
|
|
compat_cookiejar,
|
|
|
|
compat_cookiejar,
|
|
|
@ -34,6 +31,7 @@ from .compat import (
|
|
|
|
compat_get_terminal_size,
|
|
|
|
compat_get_terminal_size,
|
|
|
|
compat_http_client,
|
|
|
|
compat_http_client,
|
|
|
|
compat_kwargs,
|
|
|
|
compat_kwargs,
|
|
|
|
|
|
|
|
compat_os_name,
|
|
|
|
compat_str,
|
|
|
|
compat_str,
|
|
|
|
compat_tokenize_tokenize,
|
|
|
|
compat_tokenize_tokenize,
|
|
|
|
compat_urllib_error,
|
|
|
|
compat_urllib_error,
|
|
|
@ -95,6 +93,9 @@ from .postprocessor import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from .version import __version__
|
|
|
|
from .version import __version__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if compat_os_name == 'nt':
|
|
|
|
|
|
|
|
import ctypes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeDL(object):
|
|
|
|
class YoutubeDL(object):
|
|
|
|
"""YoutubeDL class.
|
|
|
|
"""YoutubeDL class.
|
|
|
@ -450,7 +451,7 @@ 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 os.name == 'nt' and ctypes.windll.kernel32.GetConsoleWindow():
|
|
|
|
if compat_os_name == 'nt' and ctypes.windll.kernel32.GetConsoleWindow():
|
|
|
|
# c_wchar_p() might not be necessary if `message` is
|
|
|
|
# c_wchar_p() might not be necessary if `message` is
|
|
|
|
# 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))
|
|
|
@ -521,7 +522,7 @@ class YoutubeDL(object):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if self.params.get('no_warnings'):
|
|
|
|
if self.params.get('no_warnings'):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
if not self.params.get('no_color') and self._err_file.isatty() and os.name != 'nt':
|
|
|
|
if not self.params.get('no_color') and self._err_file.isatty() and compat_os_name != 'nt':
|
|
|
|
_msg_header = '\033[0;33mWARNING:\033[0m'
|
|
|
|
_msg_header = '\033[0;33mWARNING:\033[0m'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
_msg_header = 'WARNING:'
|
|
|
|
_msg_header = 'WARNING:'
|
|
|
@ -533,7 +534,7 @@ class YoutubeDL(object):
|
|
|
|
Do the same as trouble, but prefixes the message with 'ERROR:', colored
|
|
|
|
Do the same as trouble, but prefixes the message with 'ERROR:', colored
|
|
|
|
in red if stderr is a tty file.
|
|
|
|
in red if stderr is a tty file.
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
if not self.params.get('no_color') and self._err_file.isatty() and os.name != 'nt':
|
|
|
|
if not self.params.get('no_color') and self._err_file.isatty() and compat_os_name != 'nt':
|
|
|
|
_msg_header = '\033[0;31mERROR:\033[0m'
|
|
|
|
_msg_header = '\033[0;31mERROR:\033[0m'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
_msg_header = 'ERROR:'
|
|
|
|
_msg_header = 'ERROR:'
|
|
|
|