diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 9e5620eef..eba8a58ed 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -454,6 +454,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 91e691776..beb3a5964 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 @@ -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) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 61705d1f0..7917d67b6 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -642,7 +642,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,