diff --git a/android/app/src/main/assets/pulsewall/preset-music.html b/android/app/src/main/assets/pulsewall/preset-music.html new file mode 100644 index 0000000..4ca09c5 --- /dev/null +++ b/android/app/src/main/assets/pulsewall/preset-music.html @@ -0,0 +1,1839 @@ + + + + + +音乐播放器 · ai-speaker + + + + +
+ +
+
+
🎵
+
+

音乐播放器

+

ai-speaker · JBL PS3500

+
+
+
连接中…
+
+ + +
+ +
+
+ 正在播放 + — +
+ +
+
🎧
+
未在播放
+
从右侧选一首,或让 AI 帮你找歌
+ + +
+
+
+ +
+
+ 音量 + 15 / 100 +
+
+
+
+
+
+
+ +
+
+ + + + +
+
就绪
+
+
+ + +
+
+ NAS 音乐库 + 加载中… +
+
+ +
+
+
正在读取音乐库…
+
+
+
+
🎼
+
正在读取音乐库…
+
+
+
+
+
+ + + + diff --git a/mcp.sh b/mcp.sh new file mode 100755 index 0000000..f765613 --- /dev/null +++ b/mcp.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# 一次性调用 ai-speaker MCP 工具并打印 JSON 结果 +set -uo pipefail + +BASE="http://192.168.1.111:8765/mcp" +ORIGIN="http://appassets.androidplatform.net" + +SID=$(curl -sS -i -X POST "$BASE" \ + -H "Origin: $ORIGIN" \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json, text/event-stream' \ + -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"probe","version":"1"}}}' \ + 2>/dev/null | tr -d '\r' | awk -F': ' 'tolower($1)=="mcp-session-id"{print $2; exit}') + +if [ -z "$SID" ]; then + echo "ERROR: 未能获取 session id" >&2 + exit 1 +fi + +tool="$1" +args="${2:-{\}}" + +curl -sS -X POST "$BASE" \ + -H "Origin: $ORIGIN" \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json, text/event-stream' \ + -H "mcp-session-id: $SID" \ + -d "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"$tool\",\"arguments\":$args}}" \ + 2>&1 | sed 's/^data: //' | grep '^{' | python3 -c " +import json, sys +raw = sys.stdin.read().strip() +if not raw: + print(' (空响应)') + raise SystemExit(1) +d = json.loads(raw) +r = d.get('result') +if r is None: + print(' RPC ERROR:', json.dumps(d.get('error'), ensure_ascii=False)) + raise SystemExit(1) +txt = '' +if isinstance(r.get('content'), list): + for c in r['content']: + if isinstance(c, dict) and isinstance(c.get('text'), str): + txt += c['text'] +if r.get('isError'): + print(' TOOL ERROR:', txt[:300]); raise SystemExit(1) +try: + print(json.dumps(json.loads(txt), ensure_ascii=False, indent=2)) +except Exception: + print(txt[:600]) +"