feat: Enhance audio sink with internal ffmpeg cache directory management

This commit is contained in:
JB
2025-10-06 16:50:40 -07:00
parent fd8ede318f
commit 43bee0b76e
+9
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
import json
import math
import os
import re
import subprocess
from contextlib import ExitStack
@@ -312,6 +313,14 @@ def _open_audio_sink(
metadata: Optional[Dict[str, str]] = None,
) -> AudioSink:
ffmpeg_cache = get_internal_cache_path("ffmpeg")
os.makedirs(ffmpeg_cache, exist_ok=True)
try:
import static_ffmpeg.run as static_ffmpeg_run # type: ignore
static_ffmpeg_run.LOCK_FILE = os.path.join(ffmpeg_cache, "lock.file")
except Exception:
pass
static_ffmpeg.add_paths(download_dir=ffmpeg_cache)
fmt_value = (fmt or job.output_format).lower()