0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-10 00:25:06 +00:00
Hotfix for fragmented downloads

Authored by: bashonly
This commit is contained in:
Simon Sawicki 2023-05-25 22:52:44 +02:00
parent 032de83ea9
commit edbe5b589d
No known key found for this signature in database

View file

@ -284,7 +284,7 @@ def frag_progress_hook(s):
frag_downloaded_bytes = s['downloaded_bytes'] frag_downloaded_bytes = s['downloaded_bytes']
state['downloaded_bytes'] += frag_downloaded_bytes - ctx['prev_frag_downloaded_bytes'] state['downloaded_bytes'] += frag_downloaded_bytes - ctx['prev_frag_downloaded_bytes']
ctx['speed'] = state['speed'] = self.calc_speed( ctx['speed'] = state['speed'] = self.calc_speed(
ctx['fragment_started'], time_now, frag_downloaded_bytes - ctx['frag_resume_len']) ctx['fragment_started'], time_now, frag_downloaded_bytes - ctx.get('frag_resume_len', 0))
if not ctx['live']: if not ctx['live']:
state['eta'] = self.calc_eta(state['speed'], estimated_size - state['downloaded_bytes']) state['eta'] = self.calc_eta(state['speed'], estimated_size - state['downloaded_bytes'])
ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes
@ -304,7 +304,7 @@ def _finish_frag_download(self, ctx, info_dict):
to_file = ctx['tmpfilename'] != '-' to_file = ctx['tmpfilename'] != '-'
if to_file: if to_file:
downloaded_bytes = self.filesize_or_none(ctx['filename']) downloaded_bytes = self.filesize_or_none(ctx['tmpfilename'])
else: else:
downloaded_bytes = ctx['complete_frags_downloaded_bytes'] downloaded_bytes = ctx['complete_frags_downloaded_bytes']