From ccc502f4a1c9a57d12e750ac81ee5645e7a1d548 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 20 Mar 2016 00:30:43 +0100 Subject: [PATCH] fetcher_http: update to use progressbar instead of progress --- lib/svtplay_dl/fetcher/http.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/svtplay_dl/fetcher/http.py b/lib/svtplay_dl/fetcher/http.py index c1faf08..0f1a658 100644 --- a/lib/svtplay_dl/fetcher/http.py +++ b/lib/svtplay_dl/fetcher/http.py @@ -3,7 +3,7 @@ from __future__ import absolute_import import time -from svtplay_dl.output import progress, output # FIXME use progressbar() instead +from svtplay_dl.output import output, ETA, progressbar from svtplay_dl.fetcher import VideoRetriever @@ -25,15 +25,13 @@ class HTTP(VideoRetriever): if hasattr(file_d, "read") is False: return - lastprogress = 0 + eta = ETA(total_size) for i in data.iter_content(8192): bytes_so_far += len(i) file_d.write(i) if self.options.output != "-" and not self.options.silent: - now = time.time() - if lastprogress + 1 < now: - lastprogress = now - progress(bytes_so_far, total_size) + eta.update(bytes_so_far) + progressbar(total_size, bytes_so_far, ''.join(["ETA: ", str(eta)])) if self.options.output != "-": file_d.close()