aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2023-05-25 22:52:44 +0200
committerSimon Sawicki <contact@grub4k.xyz>2023-05-25 22:52:44 +0200
commitedbe5b589dd0860a67b4e03f58db3cd2539d91c2 (patch)
treef1c57ffc764bac1251aa3e6ab199cbad80450f71
parent032de83ea9ff2f4977d9c71a93bbc1775597b762 (diff)
downloadhypervideo-pre-edbe5b589dd0860a67b4e03f58db3cd2539d91c2.tar.lz
hypervideo-pre-edbe5b589dd0860a67b4e03f58db3cd2539d91c2.tar.xz
hypervideo-pre-edbe5b589dd0860a67b4e03f58db3cd2539d91c2.zip
Bugfixes for 4823ec9f461512daa1b8ab362893bb86a6320b26
Hotfix for fragmented downloads Authored by: bashonly
-rw-r--r--yt_dlp/downloader/fragment.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index 6770815ab..53b4b604e 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -284,7 +284,7 @@ class FragmentFD(FileDownloader):
frag_downloaded_bytes = s['downloaded_bytes']
state['downloaded_bytes'] += frag_downloaded_bytes - ctx['prev_frag_downloaded_bytes']
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']:
state['eta'] = self.calc_eta(state['speed'], estimated_size - state['downloaded_bytes'])
ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes
@@ -304,7 +304,7 @@ class FragmentFD(FileDownloader):
to_file = ctx['tmpfilename'] != '-'
if to_file:
- downloaded_bytes = self.filesize_or_none(ctx['filename'])
+ downloaded_bytes = self.filesize_or_none(ctx['tmpfilename'])
else:
downloaded_bytes = ctx['complete_frags_downloaded_bytes']