minor improvements on progress output

This commit is contained in:
kikuyan 2021-07-02 17:21:19 +09:00
parent a803582717
commit cd8ff4ce8f
3 changed files with 5 additions and 3 deletions

View File

@ -419,6 +419,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
@ -241,7 +240,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,