From 835a1478b426baa3b012ecc5c2dd6a134fdda925 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 29 May 2021 02:31:10 +0530 Subject: [PATCH] Write messages to `stderr` when both `quiet` and `verbose` --- yt_dlp/YoutubeDL.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 80f54fd3e..3c237212a 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -658,12 +658,10 @@ class YoutubeDL(object): """Print message to stdout""" if self.params.get('logger'): self.params['logger'].debug(message) - elif not quiet: - message = self._bidi_workaround(message) - terminator = ['\n', ''][skip_eol] - output = message + terminator - - self._write_string(output, self._screen_file) + elif not quiet or self.params.get('verbose'): + self._write_string( + '%s%s' % (self._bidi_workaround(message), ('' if skip_eol else '\n')), + self._err_file if quiet else self._screen_file) def to_stderr(self, message): """Print message to stderr""" @@ -671,9 +669,7 @@ class YoutubeDL(object): if self.params.get('logger'): self.params['logger'].error(message) else: - message = self._bidi_workaround(message) - output = message + '\n' - self._write_string(output, self._err_file) + self._write_string('%s\n' % self._bidi_workaround(message), self._err_file) def to_console_title(self, message): if not self.params.get('consoletitle', False):