From 54b4417069d89825b33976884442588674894a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Sat, 24 Feb 2024 12:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=20ffmpeg?= =?UTF-8?q?=20=E8=B7=AF=E5=BE=84=20#15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaomusic/config.py | 1 + xiaomusic/xiaomusic.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xiaomusic/config.py b/xiaomusic/config.py index 2b15713a3..5aa0bb745 100644 --- a/xiaomusic/config.py +++ b/xiaomusic/config.py @@ -88,6 +88,7 @@ class Config: search_prefix: str = os.getenv( "XIAOMUSIC_SEARCH", "ytsearch:" ) # "bilisearch:" or "ytsearch:" + ffmpeg_location: str = os.getenv("XIAOMUSIC_FFMPEG_LOCATION", "./ffmpeg/bin") def __post_init__(self) -> None: if self.proxy: diff --git a/xiaomusic/xiaomusic.py b/xiaomusic/xiaomusic.py index 30d0ef7d0..69f8b2f8b 100644 --- a/xiaomusic/xiaomusic.py +++ b/xiaomusic/xiaomusic.py @@ -57,6 +57,7 @@ def __init__(self, config: Config): self.port = config.port self.proxy = config.proxy self.search_prefix = config.search_prefix + self.ffmpeg_location = config.ffmpeg_location # 下载对象 self.download_proc = None @@ -311,7 +312,7 @@ async def download(self, name): "-o", f"{name}.mp3", "--ffmpeg-location", - "./ffmpeg/bin", + f"{self.ffmpeg_location}", "--no-playlist", )