Flush file buffers when merging DASH or HLS segments

This commit is contained in:
rlaphoenix 2024-02-20 01:35:58 +00:00
parent 1259a26b14
commit 8de3a95c6b
2 changed files with 3 additions and 0 deletions

View File

@ -483,6 +483,7 @@ class DASH:
segment_data = try_ensure_utf8(segment_data)
segment_data = html.unescape(segment_data.decode("utf8")).encode("utf8")
f.write(segment_data)
f.flush()
segment_file.unlink()
progress(advance=1)

View File

@ -310,6 +310,7 @@ class HLS:
x.write(map_data[1])
for file in via:
x.write(file.read_bytes())
x.flush()
if delete:
file.unlink()
@ -485,6 +486,7 @@ class HLS:
continue
discontinuity_data = discontinuity_file.read_bytes()
f.write(discontinuity_data)
f.flush()
shutil.rmtree(save_dir)
progress(downloaded="Downloaded")