支持配置 ffmpeg 路径 #15

This commit is contained in:
涵曦 2024-02-24 12:49:17 +08:00
parent 17d7f54c20
commit 54b4417069
2 changed files with 3 additions and 1 deletions

View File

@ -88,6 +88,7 @@ class Config:
search_prefix: str = os.getenv( search_prefix: str = os.getenv(
"XIAOMUSIC_SEARCH", "ytsearch:" "XIAOMUSIC_SEARCH", "ytsearch:"
) # "bilisearch:" or "ytsearch:" ) # "bilisearch:" or "ytsearch:"
ffmpeg_location: str = os.getenv("XIAOMUSIC_FFMPEG_LOCATION", "./ffmpeg/bin")
def __post_init__(self) -> None: def __post_init__(self) -> None:
if self.proxy: if self.proxy:

View File

@ -57,6 +57,7 @@ class XiaoMusic:
self.port = config.port self.port = config.port
self.proxy = config.proxy self.proxy = config.proxy
self.search_prefix = config.search_prefix self.search_prefix = config.search_prefix
self.ffmpeg_location = config.ffmpeg_location
# 下载对象 # 下载对象
self.download_proc = None self.download_proc = None
@ -311,7 +312,7 @@ class XiaoMusic:
"-o", "-o",
f"{name}.mp3", f"{name}.mp3",
"--ffmpeg-location", "--ffmpeg-location",
"./ffmpeg/bin", f"{self.ffmpeg_location}",
"--no-playlist", "--no-playlist",
) )