diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index fe30758ef..11d1dec4c 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -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: diff --git a/youtube_dl/downloader/common.py b/youtube_dl/downloader/common.py index 1cdba89cd..cef05404a 100644 --- a/youtube_dl/downloader/common.py +++ b/youtube_dl/downloader/common.py @@ -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) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 0a0641bd4..9c51b34a1 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -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,