diff options
author | lightmare <[email protected]> | 2019-08-11 01:57:43 +0200 |
---|---|---|
committer | Sergey M <[email protected]> | 2019-08-11 06:57:43 +0700 |
commit | 3bce4ff7d96d845ec67ffe8e9e2715474f190d89 (patch) | |
tree | 9e0c3f5c119d7123d7d2b309ac369471e9147bd0 /youtube_dl/downloader | |
parent | ffddb112642ab394ecc11db055a064368eed42f7 (diff) | |
download | youtube-dl-3bce4ff7d96d845ec67ffe8e9e2715474f190d89.tar.gz youtube-dl-3bce4ff7d96d845ec67ffe8e9e2715474f190d89.zip |
[downloader/fragment] Fix ETA calculation of resumed download (#21992)
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r-- | youtube_dl/downloader/fragment.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube_dl/downloader/fragment.py b/youtube_dl/downloader/fragment.py index f2e5733b6..02f35459e 100644 --- a/youtube_dl/downloader/fragment.py +++ b/youtube_dl/downloader/fragment.py @@ -190,12 +190,13 @@ class FragmentFD(FileDownloader): }) def _start_frag_download(self, ctx): + resume_len = ctx['complete_frags_downloaded_bytes'] total_frags = ctx['total_frags'] # This dict stores the download progress, it's updated by the progress # hook state = { 'status': 'downloading', - 'downloaded_bytes': ctx['complete_frags_downloaded_bytes'], + 'downloaded_bytes': resume_len, 'fragment_index': ctx['fragment_index'], 'fragment_count': total_frags, 'filename': ctx['filename'], @@ -234,8 +235,8 @@ class FragmentFD(FileDownloader): state['downloaded_bytes'] += frag_downloaded_bytes - ctx['prev_frag_downloaded_bytes'] if not ctx['live']: state['eta'] = self.calc_eta( - start, time_now, estimated_size, - state['downloaded_bytes']) + start, time_now, estimated_size - resume_len, + state['downloaded_bytes'] - resume_len) state['speed'] = s.get('speed') or ctx.get('speed') ctx['speed'] = state['speed'] ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes |