fix(backend): CLI now prints a clear hint when yt-dlp is missing and exits with code 2

This commit is contained in:
2026-05-15 18:17:11 +03:00
parent f886ebcd12
commit 7715d53bba
2 changed files with 8 additions and 2 deletions
+8 -1
View File
@@ -43,7 +43,14 @@ def main(argv: list[str] | None = None) -> int:
for pl in playlists:
url = pl.get("url")
pid = extract_playlist_id(url) or (url or "")
actions = service.sync_from_config(pl)
try:
actions = service.sync_from_config(pl)
except ImportError as e:
msg = str(e)
if "yt_dlp" in msg or "yt-dlp" in msg:
print("yt-dlp Python package is required. Install with: pip install -U yt-dlp")
return 2
raise
counts: dict[str, int] = {}
for a in actions:
counts[a.type.name] = counts.get(a.type.name, 0) + 1
-1
View File
@@ -10,7 +10,6 @@ DEFAULT_CONFIG: Dict[str, Any] = {
"download_mode": "audio",
"max_video_quality": "1080p",
"save_path": "./downloads",
"yt_dlp_path": "yt-dlp",
"ffmpeg_path": "ffmpeg",
}