mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-07-03 04:23:59 +03:00
ci: fix
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user