1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-15 16:18:14 +08:00

Merge branch 'main' into allow_hardware_param

This commit is contained in:
涵曦
2023-10-16 19:24:51 +08:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ class Config:
music_path: str = os.getenv("XIAOMUSIC_MUSIC_PATH", "music")
hostname: str = os.getenv("XIAOMUSIC_HOSTNAME", "192.168.2.5")
port: int = int(os.getenv("XIAOMUSIC_PORT", "8090"))
proxy: str = os.getenv("XIAOMUSIC_PROXY", "http://192.168.2.5:8080")
proxy: str = os.getenv("XIAOMUSIC_PROXY", None)
def __post_init__(self) -> None:
if self.proxy:

View File

@@ -296,13 +296,17 @@ class XiaoMusic:
if self.download_proc:
self.download_proc.kill()
self.download_proc = await asyncio.create_subprocess_exec(
sbp_args = (
"yt-dlp", f"ytsearch:{name}",
"-x", "--audio-format", "mp3",
"--paths", self.music_path,
"-o", f"{name}.mp3",
"--proxy", f"{self.proxy}",
"--ffmpeg-location", "./ffmpeg/bin")
if self.proxy:
sbp_args += ("--proxy", f"{self.proxy}")
self.download_proc = await asyncio.create_subprocess_exec(*sbp_args)
await self.do_tts(f"正在下载歌曲{name}")
def get_filename(self, name):