fix(HLS): Remove save dir even if final merge wasn't needed

This commit is contained in:
rlaphoenix 2024-03-09 19:39:39 +00:00
parent 35501bdb9c
commit 73d9bc4f94
1 changed files with 4 additions and 2 deletions

View File

@ -507,6 +507,8 @@ class HLS:
if DOWNLOAD_LICENCE_ONLY.is_set():
return
segment_save_dir.rmdir()
# finally merge all the discontinuity save files together to the final path
segments_to_merge = [
x
@ -522,14 +524,14 @@ class HLS:
segments=segments_to_merge,
save_path=save_path
)
shutil.rmtree(save_dir)
else:
with open(save_path, "wb") as f:
for discontinuity_file in segments_to_merge:
discontinuity_data = discontinuity_file.read_bytes()
f.write(discontinuity_data)
f.flush()
shutil.rmtree(save_dir)
save_dir.rmdir()
progress(downloaded="Downloaded")