mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-23 02:26:37 -05:00
[fragment] Ensure the file is closed on error
This commit is contained in:
parent
06425e9621
commit
6ef6bcbd6b
@ -113,6 +113,7 @@ class DashSegmentsFD(FragmentFD):
|
|||||||
if count > fragment_retries:
|
if count > fragment_retries:
|
||||||
if not fatal:
|
if not fatal:
|
||||||
return False, frag_index
|
return False, frag_index
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error('Giving up after %s fragment retries' % fragment_retries)
|
self.report_error('Giving up after %s fragment retries' % fragment_retries)
|
||||||
return False, frag_index
|
return False, frag_index
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ class DashSegmentsFD(FragmentFD):
|
|||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error(
|
self.report_error(
|
||||||
'fragment %s not found, unable to continue' % frag_index)
|
'fragment %s not found, unable to continue' % frag_index)
|
||||||
return False
|
return False
|
||||||
@ -143,6 +145,7 @@ class DashSegmentsFD(FragmentFD):
|
|||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error(
|
self.report_error(
|
||||||
'fragment %s not found, unable to continue' % frag_index)
|
'fragment %s not found, unable to continue' % frag_index)
|
||||||
return False
|
return False
|
||||||
|
@ -299,6 +299,7 @@ class HlsFD(FragmentFD):
|
|||||||
if count <= fragment_retries:
|
if count <= fragment_retries:
|
||||||
self.report_retry_fragment(err, frag_index, count, fragment_retries)
|
self.report_retry_fragment(err, frag_index, count, fragment_retries)
|
||||||
if count > fragment_retries:
|
if count > fragment_retries:
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error('Giving up after %s fragment retries' % fragment_retries)
|
self.report_error('Giving up after %s fragment retries' % fragment_retries)
|
||||||
return False, frag_index
|
return False, frag_index
|
||||||
|
|
||||||
@ -403,6 +404,7 @@ class HlsFD(FragmentFD):
|
|||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error(
|
self.report_error(
|
||||||
'fragment %s not found, unable to continue' % frag_index)
|
'fragment %s not found, unable to continue' % frag_index)
|
||||||
return False
|
return False
|
||||||
@ -411,6 +413,7 @@ class HlsFD(FragmentFD):
|
|||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
ctx['dest_stream'].close()
|
||||||
self.report_error(
|
self.report_error(
|
||||||
'fragment %s not found, unable to continue' % frag_index)
|
'fragment %s not found, unable to continue' % frag_index)
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user