This commit is contained in:
Deleted user 2024-05-11 04:35:28 +08:00 committed by GitHub
commit 0ccedd2cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -438,6 +438,9 @@ class YoutubeDL(object):
'Parameter outtmpl is bytes, but should be a unicode string. '
'Put from __future__ import unicode_literals at the top of your code file or consider switching to Python 3.x.')
if not self._screen_file.isatty():
self.params['progress_with_newline'] = True
self._setup_opener()
if auto_init:

View File

@ -2,7 +2,6 @@ from __future__ import division, unicode_literals
import os
import re
import sys
import time
import random
@ -251,7 +250,7 @@ class FileDownloader(object):
self._report_progress_prev_line_length = len(fullmsg)
clear_line = '\r'
else:
clear_line = ('\r\x1b[K' if sys.stderr.isatty() else '\r')
clear_line = '\r\x1b[K'
self.to_screen(clear_line + fullmsg, skip_eol=not is_last_line)
self.to_console_title('youtube-dl ' + msg)

View File

@ -638,7 +638,7 @@ def parseOpts(overrideArguments=None):
verbosity.add_option(
'--newline',
action='store_true', dest='progress_with_newline', default=False,
help='Output progress bar as new lines')
help='Output progress bar as new lines (implied if output is not to the console)')
verbosity.add_option(
'--no-progress',
action='store_true', dest='noprogress', default=False,