mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-28 13:11:49 +00:00
minor improvements on progress output
This commit is contained in:
parent
a803582717
commit
cd8ff4ce8f
3 changed files with 5 additions and 3 deletions
|
@ -419,6 +419,9 @@ class YoutubeDL(object):
|
||||||
'Parameter outtmpl is bytes, but should be a unicode string. '
|
'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.')
|
'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()
|
self._setup_opener()
|
||||||
|
|
||||||
if auto_init:
|
if auto_init:
|
||||||
|
|
|
@ -2,7 +2,6 @@ from __future__ import division, unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ class FileDownloader(object):
|
||||||
self._report_progress_prev_line_length = len(fullmsg)
|
self._report_progress_prev_line_length = len(fullmsg)
|
||||||
clear_line = '\r'
|
clear_line = '\r'
|
||||||
else:
|
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_screen(clear_line + fullmsg, skip_eol=not is_last_line)
|
||||||
self.to_console_title('youtube-dl ' + msg)
|
self.to_console_title('youtube-dl ' + msg)
|
||||||
|
|
||||||
|
|
|
@ -638,7 +638,7 @@ def parseOpts(overrideArguments=None):
|
||||||
verbosity.add_option(
|
verbosity.add_option(
|
||||||
'--newline',
|
'--newline',
|
||||||
action='store_true', dest='progress_with_newline', default=False,
|
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(
|
verbosity.add_option(
|
||||||
'--no-progress',
|
'--no-progress',
|
||||||
action='store_true', dest='noprogress', default=False,
|
action='store_true', dest='noprogress', default=False,
|
||||||
|
|
Loading…
Reference in a new issue