Auto-install yt-dlp into %appdata%/.mc_custom on first use
The previous flow required the operator to manually install yt-dlp on the server. Now the server downloads the correct binary for the current OS/arch from GitHub Releases (latest) the first time a playlist fetch is requested, caches it under %appdata%/.mc_custom (resolved per-OS), chmod +x's it on POSIX, and skips the download on every subsequent call. - shared/paths.ts: add getAppDataDir() + getMcCustomDir() that map %appdata% to ~/.config (Linux), ~/Library/Application Support (macOS), or process.env.APPDATA (Windows) so the path is OS-agnostic. - server/youtube.ts: replace the old "probe PATH and bail" probeYtDlp with ensureYtDlp(): picks the right GitHub asset name per platform.arch (yt-dlp.exe / yt-dlp_macos / yt-dlp_linux / yt-dlp_linux_aarch64 / yt-dlp_linux_armv7l), downloads it with redirect-following https.get to the install path, chmods +x, then verifies with `--version` before reporting success. Uses an installPromise singleton so concurrent requests don't race the download. On any failure it cleans up the partial file and throws YtDlpUnavailableError with a real reason. - docs/yt-dlp-setup.md: note that auto-install is now the default; manual install is only for environments where the auto-download fails. Smoke-tested on this Linux x64 box: first call downloads to ~/.config/.mc_custom/yt-dlp_linux and reports `2026.03.17`; second call takes ~700ms (just the version probe) and reuses the cached file.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
# yt-dlp 설치 가이드
|
||||
|
||||
음악퀴즈 관리 사이트(`/op/list/.../playlist`) 기능에서 유튜브 플레이리스트 메타데이터를 가져올 때 서버에 `yt-dlp` 바이너리가 필요합니다.
|
||||
설치돼 있지 않으면 사이트에 `"서버에 yt-dlp가 설치돼 있지 않습니다. (수동 입력으로 진행)"` 라고 표시되고, 사용자가 직접 곡을 추가해야 합니다.
|
||||
> ✅ **기본 동작: 자동 설치.** 서버가 처음 플레이리스트를 불러올 때 `%appdata%/.mc_custom/`
|
||||
> (Linux 는 `~/.config/.mc_custom/`, macOS 는 `~/Library/Application Support/.mc_custom/`)
|
||||
> 에 현재 OS/아키텍처에 맞는 `yt-dlp` 바이너리를 GitHub Releases 에서 받아 권한까지 부여합니다.
|
||||
> 이미 받아둔 게 있으면 그대로 재사용합니다. 따라서 **일반적으로는 아래 수동 설치가 필요 없습니다.**
|
||||
>
|
||||
> 자동 설치가 실패하는 환경(외부 인터넷 차단, 권한 부족 등)에서만 아래 절차로 수동 설치하세요.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user