This commit is contained in:
nose
2025-11-26 00:29:10 -08:00
parent 935ce303d0
commit e9b505e609
4 changed files with 33 additions and 38 deletions

View File

@@ -54,9 +54,16 @@ def _progress_callback(status: Dict[str, Any]) -> None:
if event == "downloading":
percent = status.get("_percent_str", "?")
speed = status.get("_speed_str", "?")
debug(f"Downloading {percent} at {speed}")
eta = status.get("_eta_str", "?")
# Print progress to stdout with carriage return to update in place
sys.stdout.write(f"\r[download] {percent} at {speed} ETA {eta} ")
sys.stdout.flush()
elif event == "finished":
debug(f"✓ Download finished: {status.get('filename')}")
# Clear the progress line
sys.stdout.write("\r" + " " * 70 + "\r")
sys.stdout.flush()
# Log finished message (visible)
log(f"✓ Download finished: {status.get('filename')}")
elif event in ("postprocessing", "processing"):
debug(f"Post-processing: {status.get('postprocessor')}")
@@ -100,8 +107,8 @@ def list_formats(url: str, no_playlist: bool = False, playlist_items: Optional[s
try:
ydl_opts = {
"quiet": False,
"no_warnings": False,
"quiet": True,
"no_warnings": True,
"socket_timeout": 30,
}
@@ -154,9 +161,9 @@ def _build_ytdlp_options(opts: DownloadOptions) -> Dict[str, Any]:
base_options: Dict[str, Any] = {
"outtmpl": outtmpl,
"quiet": False,
"no_warnings": False,
"noprogress": False,
"quiet": True,
"no_warnings": True,
"noprogress": True,
"socket_timeout": 30,
"retries": 10,
"fragment_retries": 10,