From cdf5734829c832ea5bb2cc5635761e5599df9ca3 Mon Sep 17 00:00:00 2001 From: xantares Date: Sat, 14 Feb 2015 12:19:36 +0100 Subject: [PATCH] compute downloaded_bytes bytes --- youtube_dl/downloader/f4m.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/youtube_dl/downloader/f4m.py b/youtube_dl/downloader/f4m.py index 82c6ceec0..e4c123162 100644 --- a/youtube_dl/downloader/f4m.py +++ b/youtube_dl/downloader/f4m.py @@ -333,11 +333,12 @@ class F4mFD(FileDownloader): status.get('speed'), eta) # report totals to actual hooks - status['status'] = 'downloading' - #status['downloaded_bytes'] = state['downloaded_bytes'] ? - #status['total_bytes'] = ? + toplevel_status = {'status': 'downloading', 'filename': filename, 'tmpfilename': tmpfilename} + toplevel_status['downloaded_bytes'] = state['downloaded_bytes'] + if (state['downloaded_bytes'] > 0) and (progress > 0): + toplevel_status['total_bytes'] = int(100.0 * state['downloaded_bytes'] / progress) for hook in self._progress_hooks: - hook(status) + hook(toplevel_status) http_dl.add_progress_hook(frag_progress_hook)