支持配置歌曲下载源 #12
This commit is contained in:
parent
67be9125d8
commit
13336cd02c
@ -85,6 +85,9 @@ class Config:
|
||||
hostname: str = os.getenv("XIAOMUSIC_HOSTNAME", "192.168.2.5")
|
||||
port: int = int(os.getenv("XIAOMUSIC_PORT", "8090"))
|
||||
proxy: str | None = os.getenv("XIAOMUSIC_PROXY", None)
|
||||
search_prefix: str = os.getenv(
|
||||
"XIAOMUSIC_SEARCH", "ytsearch:"
|
||||
) # "bilisearch:" or "ytsearch:"
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.proxy:
|
||||
|
@ -56,6 +56,7 @@ class XiaoMusic:
|
||||
self.hostname = config.hostname
|
||||
self.port = config.port
|
||||
self.proxy = config.proxy
|
||||
self.search_prefix = config.search_prefix
|
||||
|
||||
# 下载对象
|
||||
self.download_proc = None
|
||||
@ -298,7 +299,7 @@ class XiaoMusic:
|
||||
|
||||
sbp_args = (
|
||||
"yt-dlp",
|
||||
f"ytsearch:{name}",
|
||||
f"{self.search_prefix}{name}",
|
||||
"-x",
|
||||
"--audio-format",
|
||||
"mp3",
|
||||
|
Loading…
Reference in New Issue
Block a user