新增XIAOMUSIC_DISABLE_DOWNLOAD=true时关闭音乐下载功能 see #82
This commit is contained in:
parent
6a0310fe05
commit
725d4c4ab3
@ -83,6 +83,9 @@ class Config:
|
|||||||
httpauth_password: str = os.getenv("XIAOMUSIC_HTTPAUTH_PASSWORD", "admin")
|
httpauth_password: str = os.getenv("XIAOMUSIC_HTTPAUTH_PASSWORD", "admin")
|
||||||
music_list_url: str = os.getenv("XIAOMUSIC_MUSIC_LIST_URL", "")
|
music_list_url: str = os.getenv("XIAOMUSIC_MUSIC_LIST_URL", "")
|
||||||
music_list_json: str = os.getenv("XIAOMUSIC_MUSIC_LIST_JSON", "")
|
music_list_json: str = os.getenv("XIAOMUSIC_MUSIC_LIST_JSON", "")
|
||||||
|
disable_download: bool = (
|
||||||
|
os.getenv("XIAOMUSIC_DISABLE_DOWNLOAD", "false").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
if self.proxy:
|
if self.proxy:
|
||||||
|
@ -642,6 +642,9 @@ class XiaoMusic:
|
|||||||
|
|
||||||
# 本地歌曲不存在时下载
|
# 本地歌曲不存在时下载
|
||||||
if not self.is_music_exist(name):
|
if not self.is_music_exist(name):
|
||||||
|
if self.config.disable_download:
|
||||||
|
await self.do_tts(f"本地不存在歌曲{name}")
|
||||||
|
return
|
||||||
await self.download(search_key, name)
|
await self.download(search_key, name)
|
||||||
self.log.info("正在下载中 %s", search_key + ":" + name)
|
self.log.info("正在下载中 %s", search_key + ":" + name)
|
||||||
await self.download_proc.wait()
|
await self.download_proc.wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user