mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-04-24 22:19:58 +08:00
fix: 修复下载后不自动播放的问题
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
2
xiaomusic/static/default/setting.html
vendored
2
xiaomusic/static/default/setting.html
vendored
@@ -97,7 +97,7 @@ var vConsole = new window.VConsole();
|
||||
<input id="conf_path" type="text" />
|
||||
|
||||
<label for="cache_dir">缓存文件目录:</label>
|
||||
<input id="cache_dir" type="text" />
|
||||
<input id="cache_dir" type="text" value='cache' />
|
||||
|
||||
<label for="temp_path">临时文件目录:</label>
|
||||
<input id="temp_path" type="text" value="music/tmp" />
|
||||
|
||||
2
xiaomusic/static/index.html
vendored
2
xiaomusic/static/index.html
vendored
@@ -52,7 +52,7 @@
|
||||
<a href="/static/default_past/index.html">怀旧主题</a>
|
||||
</div>
|
||||
<div class="options_list">
|
||||
<a href="/static/tailwind/index.html">Tailwind主题</a>
|
||||
<a href="/static/tailwind/index.html">Tailwind</a>
|
||||
</div>
|
||||
<div class="options_list">
|
||||
<a href="/static/pure/index.html">Pure主题</a>
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user