dfslkjelf
This commit is contained in:
@@ -12,6 +12,7 @@ Focused cmdlet for video/audio downloads from yt-dlp-supported sites:
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Sequence
|
||||
|
||||
@@ -430,10 +431,29 @@ def _build_ytdlp_options(opts: DownloadOptions) -> Dict[str, Any]:
|
||||
"fragment_retries": 10,
|
||||
"http_chunk_size": 10_485_760,
|
||||
"restrictfilenames": True,
|
||||
# Always show a progress indicator; do not tie it to debug logging.
|
||||
"progress_hooks": [_progress_callback],
|
||||
}
|
||||
|
||||
# Prefer the bundled ffmpeg shipped with the repo (used for merges/remux/postproc).
|
||||
try:
|
||||
repo_root = Path(__file__).resolve().parents[1]
|
||||
bundled_ffmpeg_dir = repo_root / "MPV" / "ffmpeg" / "bin"
|
||||
if bundled_ffmpeg_dir.exists():
|
||||
base_options.setdefault("ffmpeg_location", str(bundled_ffmpeg_dir))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# On Windows, AV/indexers can transiently lock files at the end of a download.
|
||||
# yt-dlp uses file_access_retries for renames (e.g. .part -> final). Default is low.
|
||||
try:
|
||||
if os.name == "nt":
|
||||
base_options.setdefault("file_access_retries", 40)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Avoid writing progress bars when running in quiet/background mode (e.g. mpv detached pipelines).
|
||||
if not getattr(opts, "quiet", False):
|
||||
base_options["progress_hooks"] = [_progress_callback]
|
||||
|
||||
if opts.cookies_path and opts.cookies_path.is_file():
|
||||
base_options["cookiefile"] = str(opts.cookies_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user