aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/fragment.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-04-06 00:09:08 +0800
committerJesús <heckyel@hyperbola.info>2022-04-06 00:09:08 +0800
commit0150bfdaba1b5b92521dea896f810083dbfed417 (patch)
tree98f604716f3abfe031f84e0dbb63db82c00e4dbb /yt_dlp/downloader/fragment.py
parent950cc067b8c41ac246deb4725177a372c95d8341 (diff)
parenta44ca5a470e09b5170fc9c3a46733f050fadbfae (diff)
downloadhypervideo-pre-0150bfdaba1b5b92521dea896f810083dbfed417.tar.lz
hypervideo-pre-0150bfdaba1b5b92521dea896f810083dbfed417.tar.xz
hypervideo-pre-0150bfdaba1b5b92521dea896f810083dbfed417.zip
updated from upstream | 06/04/2022 at 00:09
Diffstat (limited to 'yt_dlp/downloader/fragment.py')
-rw-r--r--yt_dlp/downloader/fragment.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index 6b75dfc62..c45a8a476 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -403,7 +403,7 @@ class FragmentFD(FileDownloader):
pass
if compat_os_name == 'nt':
- def bindoj_result(future):
+ def future_result(future):
while True:
try:
return future.result(0.1)
@@ -412,7 +412,7 @@ class FragmentFD(FileDownloader):
except concurrent.futures.TimeoutError:
continue
else:
- def bindoj_result(future):
+ def future_result(future):
return future.result()
def interrupt_trigger_iter(fg):
@@ -430,7 +430,7 @@ class FragmentFD(FileDownloader):
result = True
for tpe, job in spins:
try:
- result = result and bindoj_result(job)
+ result = result and future_result(job)
except KeyboardInterrupt:
interrupt_trigger[0] = False
finally:
@@ -494,16 +494,14 @@ class FragmentFD(FileDownloader):
self.report_error('Giving up after %s fragment retries' % fragment_retries)
def append_fragment(frag_content, frag_index, ctx):
- if not frag_content:
- if not is_fatal(frag_index - 1):
- self.report_skip_fragment(frag_index, 'fragment not found')
- return True
- else:
- ctx['dest_stream'].close()
- self.report_error(
- 'fragment %s not found, unable to continue' % frag_index)
- return False
- self._append_fragment(ctx, pack_func(frag_content, frag_index))
+ if frag_content:
+ self._append_fragment(ctx, pack_func(frag_content, frag_index))
+ elif not is_fatal(frag_index - 1):
+ self.report_skip_fragment(frag_index, 'fragment not found')
+ else:
+ ctx['dest_stream'].close()
+ self.report_error(f'fragment {frag_index} not found, unable to continue')
+ return False
return True
decrypt_fragment = self.decrypter(info_dict)