diff --git a/xiaomusic/config.py b/xiaomusic/config.py index 96e8746..5089226 100644 --- a/xiaomusic/config.py +++ b/xiaomusic/config.py @@ -316,7 +316,7 @@ class Config: @property def tag_cache_path(self): - if not os.path.exists(self.cache_dir): + if (len(self.cache_dir) > 0) and (not os.path.exists(self.cache_dir)): os.makedirs(self.cache_dir) filename = os.path.join(self.cache_dir, "tag_cache.json") return filename diff --git a/xiaomusic/httpserver.py b/xiaomusic/httpserver.py index 7cd8035..421eac6 100644 --- a/xiaomusic/httpserver.py +++ b/xiaomusic/httpserver.py @@ -151,7 +151,7 @@ async def custom_event(sid, data): await sio.emit("response", {"action": "切歌", "status": data}) -@app.post("thdaction") +@app.post("/thdaction") async def thdaction(item: Item): await sio.emit( "response", diff --git a/xiaomusic/static/default/setting.html b/xiaomusic/static/default/setting.html index fea201c..7d54200 100644 --- a/xiaomusic/static/default/setting.html +++ b/xiaomusic/static/default/setting.html @@ -97,7 +97,7 @@ var vConsole = new window.VConsole(); - + diff --git a/xiaomusic/static/index.html b/xiaomusic/static/index.html index fb64e10..1e0a7f7 100644 --- a/xiaomusic/static/index.html +++ b/xiaomusic/static/index.html @@ -52,7 +52,7 @@ 怀旧主题
- Tailwind主题 + Tailwind
Pure主题 diff --git a/xiaomusic/utils.py b/xiaomusic/utils.py index 2158871..fcd3e4c 100644 --- a/xiaomusic/utils.py +++ b/xiaomusic/utils.py @@ -241,15 +241,19 @@ async def thdplay( ): # 接口地址 target,在参数文件指定 data = {"action": action, "args": args} - async with aiohttp.ClientSession() as session: - async with session.post( - target, json=data, timeout=5 - ) as response: # 增加超时以避免长时间挂起 - # 如果响应不是200,引发异常 - response.raise_for_status() - # 读取响应文本 - text = await response.text() - return "[]" not in text + try: + async with aiohttp.ClientSession() as session: + async with session.post( + target, json=data, timeout=5 + ) as response: # 增加超时以避免长时间挂起 + # 如果响应不是200,引发异常 + response.raise_for_status() + # 读取响应文本 + text = await response.text() + return "[]" not in text + except Exception as e: + log.error(f"Error _get_web_music_duration: {e}") + return False async def downloadfile(url):