1
0
mirror of https://github.com/darkzoul5/YoutubePlaylistSync.git synced 2026-07-03 04:23:59 +03:00
This commit is contained in:
2026-05-16 18:32:30 +03:00
parent d232137e17
commit b8fb86902e
+12 -2
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from typing import List
from pathlib import Path
from typing import List, Optional
from ..models import PlaylistItem
@@ -16,7 +17,7 @@ class PlaylistScanner:
def __init__(self) -> None:
pass
def scan(self, playlist_url: str, playlist_id: str) -> List[PlaylistItem]:
def scan(self, playlist_url: str, playlist_id: str, *, ffmpeg_path: Optional[str] = None) -> List[PlaylistItem]:
try:
import yt_dlp # type: ignore
except Exception as exc: # pragma: no cover - environment dependent
@@ -29,6 +30,15 @@ class PlaylistScanner:
"dump_single_json": True,
}
# If a local ffmpeg binary is configured, pass it through so yt-dlp doesn't rely on PATH.
if ffmpeg_path:
try:
p = Path(str(ffmpeg_path))
if p.exists():
ydl_opts["ffmpeg_location"] = str(p)
except Exception:
pass
with yt_dlp.YoutubeDL(ydl_opts) as ydl: # type: ignore[attr-defined]
info = ydl.extract_info(playlist_url, download=False)