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

Auto-Generate docs 🤖

This commit is contained in:
Issues Docs [BOT]
2025-08-11 15:56:22 +00:00
parent 93bdcc7ed8
commit f2bcb1b9aa
3 changed files with 119 additions and 1 deletions

View File

@@ -461,5 +461,109 @@ config.json 是基本废弃了,作为一个初始化配置存在。
1. 目前会记录最后一次播放的歌曲,正常说播放歌曲,不带歌曲名字应该就会重头播放的。
2. 对话模式有些设备不支持实现也比较复杂xiaogpt那些项目是支持对话模式的我就懒得支持了。
---
### 评论 23 - thefreezoo
我想写个可以读小说的,现在就是可以读不能关闭了,只能一次读完,我本想重新发送一条关闭命令,上一个自定义命令没有结束,似乎不能接受新的命令,包括关机,有什么语音控制接口可以关闭这个运行中的任务吗
---
### 评论 24 - hanxi
> 我想写个可以读小说的,现在就是可以读不能关闭了,只能一次读完,我本想重新发送一条关闭命令,上一个自定义命令没有结束,似乎不能接受新的命令,包括关机,有什么语音控制接口可以关闭这个运行中的任务吗
可以看看你是怎么写的?估计得用 asyncio 异步的写法。
---
### 评论 25 - thefreezoo
> > 我想写个可以读小说的,现在就是可以读不能关闭了,只能一次读完,我本想重新发送一条关闭命令,上一个自定义命令没有结束,似乎不能接受新的命令,包括关机,有什么语音控制接口可以关闭这个运行中的任务吗
>
> 可以看看你是怎么写的?估计得用 asyncio 异步的写法。
python我用的不很熟基本逻辑都是用服务器实现的好像python不能直接这样开启异步线程import json
import threading
import requests
import asyncio
async def getbook(xiaomusic):
# global log, xiaomusic
offset = '0'
did = xiaomusic._cur_did
requests.get("http://192.168.1.16:8001/note/off?off=N",timeout=100)
while True:
url="http://192.168.1.16:8001/note/list?name=test&offset=" + offset
try:
response=requests.get(url,timeout=100)
if response.status_code==200:
print(response.text)
res = json.loads(response.text)
await xiaomusic.do_tts(did, res['data'])
offset=str(res["offset"])
if res['off'] == 1:
break
else:
print(f"no 200")
break
except requests.exceptions.RequestException as e:
print(f"{e}")
break
def read():
global log, xiaomusic
loop=asyncio.get_event_loop()
loop.run_until_complete(getbook(xiaomusic))
---
### 评论 26 - hanxi
@thefreezoo 你用了个死循环,把整个服务卡住了。你可以在死循环里加个 asyncio.sleep ,然后再写一个自定义口令杀掉你的这个 task 。
---
### 评论 27 - thefreezoo
> [@thefreezoo](https://github.com/thefreezoo) 你用了个死循环,把整个服务卡住了。你可以在死循环里加个 asyncio.sleep ,然后再写一个自定义口令杀掉你的这个 task 。
似乎还是不行,不能识别其他口令
import json
import threading
import requests
import asyncio
async def read():
global log, xiaomusic
offset = '0'
did = xiaomusic._cur_did
requests.get("http://192.168.1.16:8001/note/off?off=N",timeout=100)
while True:
url="http://192.168.1.16:8001/note/list?name=test&offset=" + offset
try:
response=requests.get(url,timeout=100)
if response.status_code==200:
print(response.text)
res = json.loads(response.text)
await xiaomusic.do_tts(did, res['data'])
offset=str(res["offset"])
if res['off'] == 1:
break
else:
print(f"no 200")
break
except requests.exceptions.RequestException as e:
print(f"{e}")
break
await asyncio.sleep(1)
---
### 评论 28 - hanxi
要不你问问ai吧你缺少一个自定义指令干掉你这个死循环。
---
[链接到 GitHub Issue](https://github.com/hanxi/xiaomusic/issues/105)