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

Compare commits

...

20 Commits

Author SHA1 Message Date
涵曦
f4487945db bump: version 0.3.63 → 0.3.64 2024-12-22 11:23:09 +08:00
涵曦
0bdd2986f1 build: update static version 2024-12-22 11:23:08 +08:00
涵曦
a72777317e fix: 使用自己架设的 sentry 服务,解决 Cloudflare 额度超量问题 2024-12-22 11:22:42 +08:00
Issues Docs [BOT]
f2e096da38 Auto-Generate docs 🤖 2024-12-22 02:26:41 +00:00
涵曦
f42398ec9f Update static.yml 2024-12-22 10:25:12 +08:00
涵曦
5121d141b4 bump: version 0.3.62 → 0.3.63 2024-12-22 10:11:27 +08:00
涵曦
7cf9751dde build: update static version 2024-12-22 10:11:25 +08:00
Issues Docs [BOT]
990defefc9 Auto-Generate docs 🤖 2024-12-22 02:07:10 +00:00
涵曦
4e6afa0e3e Update static.yml 2024-12-22 10:05:28 +08:00
涵曦
e501097ec2 perf: 只监控报错信息 2024-12-22 00:42:46 +08:00
涵曦
ea567fd55a bump: version 0.3.61 → 0.3.62 2024-12-21 23:50:57 +08:00
涵曦
9cb1931f90 build: update static version 2024-12-21 23:50:56 +08:00
涵曦
e50db9ea59 fix: 修复首次配置时,默认主题只有一个设备的问题。 2024-12-21 23:17:09 +08:00
涵曦
5c788ccaed fix: 修复一些报错问题 2024-12-21 19:32:52 +08:00
Issues Docs [BOT]
10a63e5568 Auto-Generate docs 🤖 2024-12-20 11:16:37 +00:00
Issues Docs [BOT]
2460cd3207 Auto-Generate docs 🤖 2024-12-19 13:10:27 +00:00
涵曦
2595451280 bump: version 0.3.60 → 0.3.61 2024-12-19 21:08:49 +08:00
涵曦
2c4b131c19 build: update static version 2024-12-19 21:08:48 +08:00
涵曦
fb84f36b55 refactor: 重构更新流程 2024-12-19 19:12:59 +08:00
涵曦
811e9377f7 fix: 尝试修复更新问题 2024-12-19 18:37:15 +08:00
19 changed files with 375 additions and 41 deletions

View File

@@ -43,6 +43,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2
@@ -84,6 +86,7 @@ jobs:
run: |
if [ "${{ steps.check_changes.outputs.changed }}" == "true" ]; then
git config --local user.name "Issues Docs [BOT]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Auto-Generate docs 🤖"
git push

View File

@@ -1,3 +1,32 @@
## v0.3.64 (2024-12-22)
### Fix
- 使用自己架设的 sentry 服务,解决 Cloudflare 额度超量问题
## v0.3.63 (2024-12-22)
### Perf
- 只监控报错信息
## v0.3.62 (2024-12-21)
### Fix
- 修复首次配置时,默认主题只有一个设备的问题。
- 修复一些报错问题
## v0.3.61 (2024-12-19)
### Fix
- 尝试修复更新问题
### Refactor
- 重构更新流程
## v0.3.60 (2024-12-19)
## v0.3.59 (2024-12-19)

View File

@@ -4,7 +4,7 @@ title: 微信交流群二维码
# 微信交流群二维码
![mmqrcode1734136802660](https://github.hanxi.cc/proxy/user-attachments/assets/a53867c9-f841-4873-b91b-35b877221fe1)
![mmqrcode1734721614705](https://github.hanxi.cc/proxy/user-attachments/assets/4113e68b-17a8-4067-ba89-e809b3ae817b)
## 评论

View File

@@ -1101,5 +1101,260 @@ You are receiving this because you commented.Message ID: ***@***.***>
绿联的NAS怎么更新到58版本啊没找到要用口令吗
---
### 评论 72 - duming215
网页后台可以播放,语音控制一直抽风,可以识别下载歌曲,但是不能执行其他命令。而且歌曲经常放到一半多就切歌了。。。
语音命令都是严格按关键词来说的。大佬帮忙看看
Traceback (most recent call last):
File "/app/xiaomusic/analytics.py", line 104, in post_to_umami
async with session.post(url, json=data, headers=headers) as response:
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
self._resp: _RetType = await self._coro
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 703, in _request
conn = await self._connector.connect(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 548, in connect
proto = await self._create_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1056, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1400, in _create_direct_connection
raise last_exc
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1369, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1130, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
[2024-12-20 15:39:58] [0.3.61] [INFO] analytics.py:73: analytics run_with_cancel success
[2024-12-20 15:39:58] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:39:58] [0.3.61] [INFO] xiaomusic.py:2018: 下一曲定时器不见了
[2024-12-20 15:39:58] [0.3.61] [INFO] xiaomusic.py:1936: 321 秒后将会播放下一首歌曲
[2024-12-20 15:39:58] [0.3.61] [INFO] xiaomusic.py:1307: save_cur_config ok
[15:40:29] [0.3.61] [INFO] 192.168.0.67:8041 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:41:29] [0.3.61] [INFO] 192.168.0.67:8092 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:42:29] [0.3.61] [INFO] 192.168.0.67:8164 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:797: 收到消息:播放歌曲ARE YOU OK 控制面板:False did:108581258
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:893: 匹配到指令. opkey:播放歌曲 opvalue:play oparg:ARE YOU OK
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:1465: play. search_key:ARE YOU OK name:ARE YOU OK
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:932: 没找到歌曲【ARE YOU OK】
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:1718: download cmd: yt-dlp bilisearch:ARE YOU OK -x --audio-format mp3 --audio-quality 0 --paths music/download -o ARE YOU OK.mp3 --ffmpeg-location ./ffmpeg/bin --no-playlist
[2024-12-20 15:43:07] [0.3.61] [INFO] xiaomusic.py:1627: try do_tts value:正在下载歌曲ARE YOU OK
[2024-12-20 15:43:12] [0.3.61] [INFO] xiaomusic.py:1638: do_tts ok. cur_music:周杰伦的晴天
[2024-12-20 15:43:12] [0.3.61] [INFO] xiaomusic.py:1683: Download Process is still running.
[2024-12-20 15:43:12] [0.3.61] [INFO] xiaomusic.py:1683: Download Process is still running.
[2024-12-20 15:43:12] [0.3.61] [INFO] xiaomusic.py:1739: 不会继续播放歌曲. isplaying:True isdownloading:True
[2024-12-20 15:43:12] [0.3.61] [INFO] xiaomusic.py:1721: 正在下载中 ARE YOU OK ARE YOU OK
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:558: 已从【cache/tag_cache.json】加载 tag cache
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:599: ignore_tag_absolute_dirs: []
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:572: 保存tag cache 已保存到【cache/tag_cache.json】
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:627: tag 更新完成
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1755: add_download_music add_music ARE YOU OK
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:2022: cancel_group_next_timer {'108581258': <xiaomusic.xiaomusic.XiaoMusicDevice object at 0x7f31cc6c3610>}
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:2015: 下一曲定时器已取消 9fcc3636-3b8e-4309-a430-7eb8978d94f4
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1589: cur_music ARE YOU OK
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:524: get_music_url local music. name:ARE YOU OK, filename:download/ARE YOU OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:445: get_music_sec_url. name:ARE YOU OK url:http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:459: get_music_sec_url. name:ARE YOU OK filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:464: 本地歌曲 ARE YOU OK : music/download/ARE YOU OK.mp3 http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3 的时长 133 秒
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1989: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4']
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1644: force_stop_xiaoai player_pause device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1655: {'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0, 'info': '{ "status": 2, "volume": 50, "loop_type": 1, "media_type": 3, "play_song_detail": { "audio_id": "507951590732817", "position": 8680, "duration": 60029 }, "track_list": [ "545606553022895", "176123395447980141", "525480908570653", "507951590732817", "681644918463361", "383285527150302", "1972115018265658007", "658913158921230", "519182249840274", "595248376347937" ] }'}}
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1992: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [None]
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1592: 播放 http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[15:43:18] [0.3.61] [INFO] 192.168.0.11:33301 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1871: play_one_url play_by_url device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}} url:http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1846: group_player_play http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3 ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}]
[2024-12-20 15:43:18] [0.3.61] [INFO] xiaomusic.py:1608: 【ARE YOU OK】已经开始播放了
[15:43:18] [0.3.61] [INFO] 192.168.0.11:33302 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[15:43:18] [0.3.61] [INFO] 192.168.0.11:33303 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[2024-12-20 15:43:20] [0.3.61] [ERROR] analytics.py:108: Execption Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1122, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs, sock=sock)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1103, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1133, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/xiaomusic/analytics.py", line 104, in post_to_umami
async with session.post(url, json=data, headers=headers) as response:
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
self._resp: _RetType = await self._coro
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 703, in _request
conn = await self._connector.connect(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 548, in connect
proto = await self._create_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1056, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1400, in _create_direct_connection
raise last_exc
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1369, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1130, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
[2024-12-20 15:43:20] [0.3.61] [INFO] analytics.py:73: analytics run_with_cancel success
[2024-12-20 15:43:20] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:43:20] [0.3.61] [INFO] xiaomusic.py:2018: 下一曲定时器不见了
[2024-12-20 15:43:20] [0.3.61] [INFO] xiaomusic.py:1936: 136 秒后将会播放下一首歌曲
[2024-12-20 15:43:20] [0.3.61] [INFO] xiaomusic.py:1307: save_cur_config ok
[15:43:29] [0.3.61] [INFO] 192.168.0.67:8205 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:797: 收到消息:播放歌曲 控制面板:False did:108581258
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:855: 完全匹配指令. query:播放歌曲 opvalue:play
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:1465: play. search_key: name:ARE YOU OK
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:930: 根据【ARE YOU OK】找到歌曲【['ARE YOU OK']】
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:1440: 没打乱 全部 ['周杰伦的晴天', '周杰伦稻香', '小猪佩奇的故事']
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:2022: cancel_group_next_timer {'108581258': <xiaomusic.xiaomusic.XiaoMusicDevice object at 0x7f31cc6c3610>}
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:2015: 下一曲定时器已取消 9fcc3636-3b8e-4309-a430-7eb8978d94f4
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:1589: cur_music ARE YOU OK
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:524: get_music_url local music. name:ARE YOU OK, filename:download/ARE YOU OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:445: get_music_sec_url. name:ARE YOU OK url:http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:459: get_music_sec_url. name:ARE YOU OK filename:music/download/ARE YOU OK.mp3
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:464: 本地歌曲 ARE YOU OK : music/download/ARE YOU OK.mp3 http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3 的时长 133 秒
[2024-12-20 15:43:57] [0.3.61] [INFO] xiaomusic.py:1989: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4']
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1644: force_stop_xiaoai player_pause device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1655: {'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0, 'info': '{ "status": 1, "volume": 50, "loop_type": 1 }'}}
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1668: stop_if_xiaoai_is_playing player_stop device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 enable_force_stop:False ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1992: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [None]
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1592: 播放 http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[15:43:58] [0.3.61] [INFO] 192.168.0.11:33306 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1871: play_one_url play_by_url device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}} url:http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1846: group_player_play http://192.168.0.3:8090/music/download/ARE%20YOU%20OK.mp3 ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}]
[2024-12-20 15:43:58] [0.3.61] [INFO] xiaomusic.py:1608: 【ARE YOU OK】已经开始播放了
[15:43:58] [0.3.61] [INFO] 192.168.0.11:33307 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[15:43:58] [0.3.61] [INFO] 192.168.0.11:33308 - "GET /music/download/ARE%20YOU%20OK.mp3 HTTP/1.1" 206
[2024-12-20 15:44:00] [0.3.61] [ERROR] analytics.py:108: Execption Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1122, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs, sock=sock)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1103, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1133, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/xiaomusic/analytics.py", line 104, in post_to_umami
async with session.post(url, json=data, headers=headers) as response:
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
self._resp: _RetType = await self._coro
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 703, in _request
conn = await self._connector.connect(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 548, in connect
proto = await self._create_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1056, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1400, in _create_direct_connection
raise last_exc
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1369, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1130, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
[2024-12-20 15:44:00] [0.3.61] [INFO] analytics.py:73: analytics run_with_cancel success
[2024-12-20 15:44:00] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:44:00] [0.3.61] [INFO] xiaomusic.py:2018: 下一曲定时器不见了
[2024-12-20 15:44:00] [0.3.61] [INFO] xiaomusic.py:1936: 136 秒后将会播放下一首歌曲
[2024-12-20 15:44:00] [0.3.61] [INFO] xiaomusic.py:1307: save_cur_config ok
[15:44:29] [0.3.61] [INFO] 192.168.0.67:8252 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:797: 收到消息:播放歌曲周杰伦的搁浅 控制面板:False did:108581258
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:893: 匹配到指令. opkey:播放歌曲 opvalue:play oparg:周杰伦的搁浅
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1465: play. search_key:周杰伦的搁浅 name:周杰伦的搁浅
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:930: 根据【周杰伦的搁浅】找到歌曲【['周杰伦的晴天']】
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1440: 没打乱 最近新增 ['周杰伦的晴天', '周杰伦稻香', '小猪佩奇的故事']
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:2022: cancel_group_next_timer {'108581258': <xiaomusic.xiaomusic.XiaoMusicDevice object at 0x7f31cc6c3610>}
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:2015: 下一曲定时器已取消 9fcc3636-3b8e-4309-a430-7eb8978d94f4
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1589: cur_music 周杰伦的晴天
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/周杰伦的晴天.mp3
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:524: get_music_url local music. name:周杰伦的晴天, filename:download/周杰伦的晴天.mp3
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:445: get_music_sec_url. name:周杰伦的晴天 url:http://192.168.0.3:8090/music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:414: try get_filename. filename:music/download/周杰伦的晴天.mp3
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:459: get_music_sec_url. name:周杰伦的晴天 filename:music/download/周杰伦的晴天.mp3
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:464: 本地歌曲 周杰伦的晴天 : music/download/周杰伦的晴天.mp3 http://192.168.0.3:8090/music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3 的时长 318 秒
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1989: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4']
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1644: force_stop_xiaoai player_pause device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}
[2024-12-20 15:44:36] [0.3.61] [INFO] xiaomusic.py:1655: {'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0, 'info': '{ "status": 1, "volume": 50, "loop_type": 1 }'}}
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1668: stop_if_xiaoai_is_playing player_stop device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 enable_force_stop:False ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1992: group_force_stop_xiaoai ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [None]
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1592: 播放 http://192.168.0.3:8090/music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1871: play_one_url play_by_url device_id:9fcc3636-3b8e-4309-a430-7eb8978d94f4 ret:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}} url:http://192.168.0.3:8090/music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1846: group_player_play http://192.168.0.3:8090/music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3 ['9fcc3636-3b8e-4309-a430-7eb8978d94f4'] [{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0}}]
[2024-12-20 15:44:37] [0.3.61] [INFO] xiaomusic.py:1608: 【周杰伦的晴天】已经开始播放了
[15:44:37] [0.3.61] [INFO] 192.168.0.11:33311 - "GET /music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3 HTTP/1.1" 206
[15:44:37] [0.3.61] [INFO] 192.168.0.11:33312 - "GET /music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3 HTTP/1.1" 206
[15:44:37] [0.3.61] [INFO] 192.168.0.11:33313 - "GET /music/download/%E5%91%A8%E6%9D%B0%E4%BC%A6%E7%9A%84%E6%99%B4%E5%A4%A9.mp3 HTTP/1.1" 206
[2024-12-20 15:44:38] [0.3.61] [ERROR] analytics.py:108: Execption Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1122, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs, sock=sock)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1103, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1133, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/xiaomusic/analytics.py", line 104, in post_to_umami
async with session.post(url, json=data, headers=headers) as response:
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
self._resp: _RetType = await self._coro
File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 703, in _request
conn = await self._connector.connect(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 548, in connect
proto = await self._create_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1056, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1400, in _create_direct_connection
raise last_exc
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1369, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1130, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host umami.hanxi.cc:443 ssl:default [Connection reset by peer]
[2024-12-20 15:44:38] [0.3.61] [INFO] analytics.py:73: analytics run_with_cancel success
[2024-12-20 15:44:38] [0.3.61] [INFO] xiaomusic.py:2012: cancel_next_timer
[2024-12-20 15:44:38] [0.3.61] [INFO] xiaomusic.py:2018: 下一曲定时器不见了
[2024-12-20 15:44:38] [0.3.61] [INFO] xiaomusic.py:1936: 321 秒后将会播放下一首歌曲
[2024-12-20 15:44:38] [0.3.61] [INFO] xiaomusic.py:1307: save_cur_config ok
[15:45:29] [0.3.61] [INFO] 192.168.0.67:8295 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:46:29] [0.3.61] [INFO] 192.168.0.67:8386 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:46:58] [0.3.61] [INFO] 192.168.0.67:8473 - "GET /getsetting HTTP/1.1" 200
[15:46:58] [0.3.61] [INFO] 192.168.0.67:8472 - "GET /getversion HTTP/1.1" 200
[15:46:58] [0.3.61] [INFO] 192.168.0.67:8473 - "GET /musiclist HTTP/1.1" 200
[15:46:58] [0.3.61] [INFO] 192.168.0.67:8473 - "GET /curplaylist?did=108581258 HTTP/1.1" 200
[15:46:58] [0.3.61] [INFO] 192.168.0.67:8479 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[2024-12-20 15:46:59] [0.3.61] [INFO] xiaomusic.py:1951: get_volume. playing_info:{'code': 0, 'message': "Msg has been successfully proxy to the device, this service is a simple proxy, if you encounter any problems pls contact ROM's developers directly!!!", 'data': {'code': 0, 'info': '{ "status": 1, "volume": 50, "loop_type": 1 }'}}
[2024-12-20 15:46:59] [0.3.61] [INFO] xiaomusic.py:1958: get_volume. volume:50
[15:46:59] [0.3.61] [INFO] 192.168.0.67:8472 - "GET /getvolume?did=108581258 HTTP/1.1" 200
[15:46:59] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /latestversion HTTP/1.1" 200
[15:47:01] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:47:04] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:47:05] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:47:07] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:47:10] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /playingmusic?did=108581258 HTTP/1.1" 200
[15:47:12] [0.3.61] [INFO] 192.168.0.67:8478 - "GET /getversion HTTP/1.1" 200 #
---
[链接到 GitHub Issue](https://github.com/hanxi/xiaomusic/issues/99)

View File

@@ -1,5 +1,28 @@
# 版本日志
## v0.3.63 (2024-12-22)
### Perf
- 只监控报错信息
## v0.3.62 (2024-12-21)
### Fix
- 修复首次配置时,默认主题只有一个设备的问题。
- 修复一些报错问题
## v0.3.61 (2024-12-19)
### Fix
- 尝试修复更新问题
### Refactor
- 重构更新流程
## v0.3.60 (2024-12-19)
## v0.3.59 (2024-12-19)

22
pdm.lock generated
View File

@@ -5,7 +5,7 @@
groups = ["default", "dev", "lint"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:69e5e664520761c67366902346f147c8f750335eb6fb5843277776c1fe439ff3"
content_hash = "sha256:be03d4a0e0e150847ab753a6b65d34c908944d20c37203ca0e3edba976f0aa80"
[[metadata.targets]]
requires_python = "==3.10.12"
@@ -891,35 +891,35 @@ files = [
[[package]]
name = "sentry-sdk"
version = "2.19.2"
requires_python = ">=3.6"
version = "1.45.1"
summary = "Python client for Sentry (https://sentry.io)"
groups = ["default"]
marker = "python_full_version == \"3.10.12\""
dependencies = [
"certifi",
"urllib3>=1.26.11",
"urllib3>=1.25.7; python_version <= \"3.4\"",
"urllib3>=1.26.11; python_version >= \"3.6\"",
"urllib3>=1.26.9; python_version == \"3.5\"",
]
files = [
{file = "sentry_sdk-2.19.2-py2.py3-none-any.whl", hash = "sha256:ebdc08228b4d131128e568d696c210d846e5b9d70aa0327dec6b1272d9d40b84"},
{file = "sentry_sdk-2.19.2.tar.gz", hash = "sha256:467df6e126ba242d39952375dd816fbee0f217d119bf454a8ce74cf1e7909e8d"},
{file = "sentry_sdk-1.45.1-py2.py3-none-any.whl", hash = "sha256:608887855ccfe39032bfd03936e3a1c4f4fc99b3a4ac49ced54a4220de61c9c1"},
{file = "sentry_sdk-1.45.1.tar.gz", hash = "sha256:a16c997c0f4e3df63c0fc5e4207ccb1ab37900433e0f72fef88315d317829a26"},
]
[[package]]
name = "sentry-sdk"
version = "2.19.2"
version = "1.45.1"
extras = ["fastapi"]
requires_python = ">=3.6"
summary = "Python client for Sentry (https://sentry.io)"
groups = ["default"]
marker = "python_full_version == \"3.10.12\""
dependencies = [
"fastapi>=0.79.0",
"sentry-sdk==2.19.2",
"sentry-sdk==1.45.1",
]
files = [
{file = "sentry_sdk-2.19.2-py2.py3-none-any.whl", hash = "sha256:ebdc08228b4d131128e568d696c210d846e5b9d70aa0327dec6b1272d9d40b84"},
{file = "sentry_sdk-2.19.2.tar.gz", hash = "sha256:467df6e126ba242d39952375dd816fbee0f217d119bf454a8ce74cf1e7909e8d"},
{file = "sentry_sdk-1.45.1-py2.py3-none-any.whl", hash = "sha256:608887855ccfe39032bfd03936e3a1c4f4fc99b3a4ac49ced54a4220de61c9c1"},
{file = "sentry_sdk-1.45.1.tar.gz", hash = "sha256:a16c997c0f4e3df63c0fc5e4207ccb1ab37900433e0f72fef88315d317829a26"},
]
[[package]]

View File

@@ -1,6 +1,6 @@
[project]
name = "xiaomusic"
version = "0.3.60"
version = "0.3.64"
description = "Play Music with xiaomi AI speaker"
authors = [
{name = "涵曦", email = "im.hanxi@gmail.com"},
@@ -20,7 +20,7 @@ dependencies = [
"pillow>=10.4.0",
"python-multipart>=0.0.12",
"requests>=2.32.3",
"sentry-sdk[fastapi]>=2.19.2",
"sentry-sdk[fastapi]==1.45.1",
]
requires-python = ">=3.10,<=3.12"
readme = "README.md"

View File

@@ -17,6 +17,7 @@ command=/app/.venv/bin/python3 /app/xiaomusic.py
directory=/app
autostart=true
autorestart=true
startretries=0
stderr_logfile=/app/xiaomusic.log.txt
stdout_logfile=/app/xiaomusic.log.txt

View File

@@ -1 +1 @@
__version__ = "0.3.60"
__version__ = "0.3.64"

View File

@@ -7,7 +7,7 @@ import signal
import sentry_sdk
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger
LOGO = r"""
__ __ _ __ __ _
@@ -20,9 +20,8 @@ LOGO = r"""
sentry_sdk.init(
dsn="https://659690a901a37237df8097a9eb95e60f@github.hanxi.cc/sentry/4508470200434688",
traces_sample_rate=0.1,
profiles_sample_rate=0.05,
# dsn="https://659690a901a37237df8097a9eb95e60f@github.hanxi.cc/sentry/4508470200434688",
dsn="https://ffe4962642d04b29afe62ebd1a065231@glitchtip.hanxi.cc/1",
integrations=[
AsyncioIntegration(),
LoggingIntegration(
@@ -32,6 +31,7 @@ sentry_sdk.init(
],
# debug=True,
)
ignore_logger("miservice")
def main():

View File

@@ -75,7 +75,7 @@ class Device:
device_id: str = ""
hardware: str = ""
name: str = ""
play_type: int = ""
play_type: int = PLAY_TYPE_RND
cur_music: str = ""
cur_playlist: str = ""

View File

@@ -6,9 +6,9 @@
<meta name="viewport" content="width=device-width">
<title>Debug For XiaoMusic</title>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734586382">
<link rel="stylesheet" type="text/css" href="./main.css?version=1734837788">
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script src="./jquery-3.7.1.min.js?version=1734586382"></script>
<script src="./jquery-3.7.1.min.js?version=1734837788"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>

View File

@@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>歌曲下载工具</title>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734586382">
<script src="./jquery-3.7.1.min.js?version=1734586382"></script>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734837788">
<script src="./jquery-3.7.1.min.js?version=1734837788"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>

View File

@@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小爱音箱操控面板</title>
<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet">
<script src="./jquery-3.7.1.min.js?version=1734586382"></script>
<link rel="stylesheet" href="./main.css?version=1734586382">
<script src="./jquery-3.7.1.min.js?version=1734837788"></script>
<link rel="stylesheet" href="./main.css?version=1734837788">
<link rel="icon" href="./favicon.ico">
<!-- Google tag (gtag.js) -->
@@ -202,7 +202,7 @@
</label>
<select id="update-version" class="version-selector">
<option value="main" selected>测试版</option>
<option value="test" selected>test</option>
</select>
<label for="lite">选择类型:</label>
@@ -220,7 +220,7 @@
Powered by XiaoMusic
</div>
<script src="./md.js?version=1734586382">
<script src="./md.js?version=1734837788">
</script>
</body>

View File

@@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width">
<title>M3U to JSON Converter</title>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734586382">
<link rel="stylesheet" type="text/css" href="./main.css?version=1734837788">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>

View File

@@ -83,6 +83,9 @@ function nextTrack() {
function togglePlayMode(isSend = true) {
const modeBtnIcon = $("#modeBtn .material-icons");
if (playModeIndex == '') {
playModeIndex = 2;
}
modeBtnIcon.text(playModes[playModeIndex].icon);
$("#modeBtn .tooltip").text(playModes[playModeIndex].cmd);
// return;

View File

@@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width">
<title>小爱音箱操控面板</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="./jquery-3.7.1.min.js?version=1734586382"></script>
<script src="./setting.js?version=1734586382"></script>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734586382">
<script src="./jquery-3.7.1.min.js?version=1734837788"></script>
<script src="./setting.js?version=1734837788"></script>
<link rel="stylesheet" type="text/css" href="./main.css?version=1734837788">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z09NC1K7ZW"></script>

View File

@@ -17,7 +17,6 @@ import re
import shutil
import string
import subprocess
import tarfile
import tempfile
import urllib.parse
from collections.abc import AsyncIterator
@@ -337,7 +336,7 @@ async def get_local_music_duration(filename, ffmpeg_location="./ffmpeg/bin"):
m = await loop.run_in_executor(None, mutagen.File, filename)
duration = m.info.length
except Exception as e:
log.error(f"Error getting local music {filename} duration: {e}")
log.warning(f"Error getting local music {filename} duration: {e}")
return duration
@@ -674,8 +673,16 @@ def _resize_save_image(image_bytes, save_path, max_size=300):
def extract_audio_metadata(file_path, save_root):
audio = mutagen.File(file_path)
metadata = Metadata()
audio = None
try:
audio = mutagen.File(file_path)
except Exception as e:
log.warning(f"Error extract_audio_metadata file: {file_path} {e}")
if audio is None:
return asdict(metadata)
tags = audio.tags
if tags is None:
return asdict(metadata)
@@ -1091,17 +1098,29 @@ async def download_and_extract(url: str, target_directory: str):
async for chunk in response.content.iter_any():
f.write(chunk)
log.info(f"文件下载完成: {file_name}")
# 解压下载的文件
if file_name.endswith(".tar.gz"):
with tarfile.open(file_name, "r:gz") as tar:
tar.extractall(path=target_directory)
log.info(f"文件解压完成到: {target_directory}")
await extract_tar_gz(file_name, target_directory)
else:
ret = f"下载失败, 包有问题: {file_name}"
log.warning(ret)
else:
ret = f"下载失败, 状态码: {response.status}"
log.warning(ret)
return ret
async def extract_tar_gz(file_name: str, target_directory: str):
# 使用 asyncio.create_subprocess_exec 执行 tar 解压命令
command = ["tar", "-xzvf", file_name, "-C", target_directory]
# 启动子进程执行解压命令
await asyncio.create_subprocess_exec(*command)
# 不等待子进程完成
log.info(f"extract_tar_gz ing {file_name}")
def chmodfile(file_path: str):
try:
os.chmod(file_path, 0o775)

View File

@@ -253,6 +253,7 @@ class XiaoMusic:
device.device_id = device_id
device.hardware = hardware
device.name = name
device.play_type = PLAY_TYPE_RND
devices[did] = device
self.config.devices = devices
self.log.info(f"选中的设备: {devices}")
@@ -265,7 +266,7 @@ class XiaoMusic:
return cookie_jar
if not os.path.exists(self.mi_token_home):
self.log.error(f"{self.mi_token_home} file not exist")
self.log.warning(f"{self.mi_token_home} file not exist")
return None
with open(self.mi_token_home, encoding="utf-8") as f:
@@ -325,7 +326,7 @@ class XiaoMusic:
# 检查响应状态码
if r.status != 200:
self.log.error(f"Request failed with status {r.status}")
self.log.warning(f"Request failed with status {r.status}")
continue
except asyncio.CancelledError:
@@ -1646,7 +1647,7 @@ class XiaoMusicDevice:
)
await self.stop_if_xiaoai_is_playing(device_id)
except Exception as e:
self.log.exception(f"Execption {e}")
self.log.warning(f"Execption {e}")
async def get_if_xiaoai_is_playing(self):
playing_info = await self.xiaomusic.mina_service.player_get_status(