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

add docker

This commit is contained in:
涵曦
2023-10-15 10:58:53 +08:00
parent 454e0ac052
commit e91e203fb0
7 changed files with 188 additions and 7 deletions

View File

@@ -53,9 +53,14 @@ class Config:
cookie: str = ""
use_command: bool = True
verbose: bool = False
music_path: str = "music"
hostname: str | None = "192.168.2.5"
port: int | None = 8090
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")
def __post_init__(self) -> None:
if self.proxy:
validate_proxy(self.proxy)
@property
def tts_command(self) -> str:

View File

@@ -78,6 +78,7 @@ class XiaoMusic:
self.music_path = config.music_path
self.hostname = config.hostname
self.port = config.port
self.proxy = config.proxy
# 下载对象
self.download_proc = None
@@ -300,6 +301,7 @@ class XiaoMusic:
"-x", "--audio-format", "mp3",
"--paths", self.music_path,
"-o", f"{name}.mp3",
"--proxy", f"{self.proxy}",
"--ffmpeg-location", "./ffmpeg/bin")
await self.do_tts(f"正在下载歌曲{name}")