feat(dl): name the free space of a nearly full temp volume on the failure line

This commit is contained in:
imSp4rky
2026-11-28 14:35:29 -07:00
parent 5167f4f9d9
commit 7856d53950
8 changed files with 156 additions and 9 deletions
+3
View File
@@ -33,6 +33,7 @@ from rich import filesize
from unshackle.core.config import config
from unshackle.core.constants import DOWNLOAD_CANCELLED, DownloadCancelled
from unshackle.core.remote_protocol import APIErrorCode, coded
from unshackle.core.utilities import get_debug_logger, get_extension, log_event
from unshackle.core.utils import run_proxy
@@ -1205,6 +1206,8 @@ def download(
# so the caller fails fast instead of hitting a missing segment at merge time
if not cancelled:
exc.add_note(f"{GAVE_UP_NOTE} {failures} failed attempts over {_time() - started:.0f}s")
if disk_error:
coded(exc, APIErrorCode.DOWNLOAD_ERROR)
raise
return
if not part_mode:
+8 -4
View File
@@ -70,15 +70,19 @@ def sweep_task_dirs(root: Path) -> None:
entry.unlink(missing_ok=True)
def temp_root() -> Path:
"""The configured temp dir, also when config.directories.temp points at a task dir inside it."""
temp = config.directories.temp
return temp.parent if temp.name.startswith(TASK_PREFIX) else temp
def resume_stash() -> Path | None:
"""The dir beside the task dirs that keeps a failed track's segments for the next run.
None outside a task dir: there config.directories.temp itself outlives the run.
"""
temp = config.directories.temp
if not temp.name.startswith(TASK_PREFIX):
return None
return temp.parent / RESUME_STASH
root = temp_root()
return None if root == config.directories.temp else root / RESUME_STASH
def _move_with_sidecar(source: Path, target: Path) -> bool: