forked from DRMTalks/devine
fix(aria2c): Support aria2(c) 1.37.0 by handling upstream regression
From aria2c's changelog (2007-09-02): ``` Now *.aria2 contorol file is first saved to *.aria2__temp and if it is successful, then renamed to *.aria2. This prevents *.aria2 file from being truncated or corrupted when file system becomes out of space. ``` It seems something went wrong in 1.37.0 resulting in these files sometimes not being renamed back to `.aria2` and then being left there for good. The fix for devine would be to simply detect `.aria2__temp` and delete them once all segments finish downloading. My only worry here is the root cause for why it has failed to rename. Did the download actually complete without error? According to aria2c's RPC, no errors occurred. There's no way to add support for Aria2(c) 1.37.0 without this sort of change as the files to seem to download correctly regardless of the file not being renamed and then deleted. Fixes #71
This commit is contained in:
parent
79506dda75
commit
ba801739fe
|
@ -483,6 +483,10 @@ class DASH:
|
|||
status_update["downloaded"] = f"DASH {downloaded}"
|
||||
progress(**status_update)
|
||||
|
||||
# see https://github.com/devine-dl/devine/issues/71
|
||||
for control_file in save_dir.glob("*.aria2__temp"):
|
||||
control_file.unlink()
|
||||
|
||||
segments_to_merge = sorted(save_dir.iterdir())
|
||||
progress(downloaded="Merging", completed=0, total=len(segments_to_merge))
|
||||
|
||||
|
|
|
@ -291,6 +291,10 @@ class HLS:
|
|||
status_update["downloaded"] = f"HLS {downloaded}"
|
||||
progress(**status_update)
|
||||
|
||||
# see https://github.com/devine-dl/devine/issues/71
|
||||
for control_file in segment_save_dir.glob("*.aria2__temp"):
|
||||
control_file.unlink()
|
||||
|
||||
progress(total=total_segments, completed=0, downloaded="Merging")
|
||||
|
||||
name_len = len(str(total_segments))
|
||||
|
|
|
@ -225,6 +225,9 @@ class Track:
|
|||
if not file_downloaded:
|
||||
progress(**status_update)
|
||||
|
||||
# see https://github.com/devine-dl/devine/issues/71
|
||||
save_path.with_suffix(f"{save_path.suffix}.aria2__temp").unlink(missing_ok=True)
|
||||
|
||||
self.path = save_path
|
||||
if callable(self.OnDownloaded):
|
||||
self.OnDownloaded()
|
||||
|
|
Loading…
Reference in New Issue