aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-04-30 19:42:58 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-04-30 19:42:58 +0200
commit4ae9e558221ca9be553c7f3fdf5290cd12505283 (patch)
tree95acbacc13afe797af70053b45e4c06758b7f150 /youtube_dl/FileDownloader.py
parent8749b7127391948f9a71148c5ae00adcfbb24a33 (diff)
Correctly clear the line before writing a new status line
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index 80c2546ea..a67d3c902 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -345,12 +345,13 @@ class FileDownloader(object):
"""Report download progress."""
if self.params.get('noprogress', False):
return
+ clear_line = (u'\x1b[K' if sys.stderr.isatty() and os.name != 'nt' else u'')
if self.params.get('progress_with_newline', False):
self.to_screen(u'[download] %s of %s at %s ETA %s' %
(percent_str, data_len_str, speed_str, eta_str))
else:
- self.to_screen(u'\r[download] %s of %s at %s ETA %s' %
- (percent_str, data_len_str, speed_str, eta_str), skip_eol=True)
+ self.to_screen(u'\r%s[download] %s of %s at %s ETA %s' %
+ (clear_line, percent_str, data_len_str, speed_str, eta_str), skip_eol=True)
self.to_cons_title(u'youtube-dl - %s of %s at %s ETA %s' %
(percent_str.strip(), data_len_str.strip(), speed_str.strip(), eta_str.strip()))