puterjam

Roon Controller

设计创意v1.0.3
作者:puterjam更新于 2026-05-11共 4 个版本 · 最新版本发布于 2026-01-29roon-controller@clawhub_puterjam/roon-controller
音频处理#Music

据 AlphaMoat 统计,截至 2026-09,Roon Controller 累计下载 3,047 次、获 3 个星标,在全部 5,078 个 AI 技能中排名第 3,695 位,在「设计创意」分类(512 个)中排名第 348 位。

累计安装
121
累计下载
3,047
星标
3
全站排名
#3,695
全站前 73% · 「设计创意」前 68%
平台累计安装累计下载星标评论
ClawHub ↗992,9763-
SkillHub ↗1213,0473—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

主文列出播放、暂停、切换曲目、获取当前曲目、列出区域和切换区域等 Python 与命令行示例;首次使用需要在 Roon 中授权扩展,运行脚本的设备须能通过网络访问 Roon Core。该技能能控制本地网络中的播放设备,只应在可信且预期会控制目标 Core 的设备和网络上使用。授权令牌会保存在本地文件中,应限制文件权限;停止使用后撤销 Roon 扩展授权,并考虑在虚拟环境中安装和固定依赖版本。

资料发布于 2026-10-29

可以用来做什么

  • 规划查找 Roon Core 和选择播放区域的步骤
  • 设计播放控制与当前曲目查询的命令流程
  • 审查本地授权令牌、网络访问和依赖版本的保护方式

什么时候用

  • 需要通过授权的 Roon Core 管理播放区域或查询曲目,并确认设备位于可信网络时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

不实际控制播放器,列出初次授权、区域确认和令牌保护的准备事项。
为停止使用 Roon Controller 制定本地授权令牌保护与撤销扩展授权的清理步骤。

月度数据趋势

累计下载3,047
2,1202,6183,1162026-03 · 累计下载 2,1892026-05 · 累计下载 2,5002026-06 · 累计下载 2,6112026-07 · 累计下载 2,7972026-08 · 累计下载 2,8792026-09 · 累计下载 3,04726-0326-09
星标3
2342026-03 · 星标 32026-05 · 星标 32026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 326-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,047—3
2026-082,879+2.9%3
2026-072,797+7.1%3
2026-062,611+4.4%3
2026-052,500—3
2026-032,189—3

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.8 KB · ClawHub v1.0.3
---
name: roon-controller
description: Control Roon music player through Roon API with automatic Core discovery and zone filtering. Supports play/pause, next/previous track, and current track query. Automatically finds Muspi zones. Supports Chinese commands.
---

# Roon Control Skill

Control the Roon music player with Chinese command support.

## Quick Start
展开全部(共 204 行)

### Install Dependencies

```bash
pip install roonapi
```

### Usage Examples

```python
from roon_controller import RoonController

# Create controller (token will be saved automatically)
controller = RoonController(verbose=True)

# Play/Pause
result = controller.play_pause()

# Next track
result = controller.next()

# Get current track
track_info = controller.get_current_track()
print(f"Now playing: {track_info['track']}")
```

## Core Features

### 1. Automatic Discovery and Connection
- Automatic Roon Core discovery
- Token automatically saved to `~/clawd/roon_config.json`
- Auto-reconnect after restart, no re-authorization needed

### 2. Zone Selection and Switching
- Supports switching between any available zone
- Selected zone is saved in config and persists across restarts
- If no zone is selected, defaults to zones ending with "[roon]"
- Use `set_zone()` to switch zones programmatically

**Switch Zone**
```python
result = controller.set_zone("Living Room")
# {"success": True, "message": "Switched to zone: Living Room", "zone": "Living Room"}
```

**Get Current Zone**
```python
zone = controller.get_current_zone()
# Returns zone info dict with zone_id and zone_data
```

### 3. Playback Control

**Play**
```python
result = controller.play()
# {"success": True, "message": "Playback started", "zone": "Living Room Muspi"}
```

**Pause**
```python
result = controller.pause()
# {"success": True, "message": "Paused", "zone": "Living Room Muspi"}
```

**Play/Pause Toggle**
```python
result = controller.play_pause()
```

**Previous Track**
```python
result = controller.previous()
```

**Next Track**
```python
result = controller.next()
```

### 4. Get Current Track

```python
track_info = controller.get_current_track()
# Returns:
# {
#   "success": True,
#   "is_playing": True,
#   "zone": "Living Room Muspi",
#   "track": "Bohemian Rhapsody",
#   "artist": "Queen",
#   "album": "A Night at the Opera",
#   "seek_position": 12345,  # milliseconds
#   "length": 354000        # milliseconds
# }
```

### 5. List All Zones

```python
zones = controller.list_zones()
# ["Living Room Muspi", "Kitchen", "Bedroom"]
```

## Command Line Tool

The script can be used as a command line tool:

```bash
# Play
python roon_controller.py play

# Pause
python roon_controller.py pause

# Previous track
python roon_controller.py prev

# Next track
python roon_controller.py next

# View current track
python roon_controller.py status

# List all zones
python roon_controller.py zones -v

# switch zone
python roon_controller.py switch zonename
```

## Chinese Command Support

The skill supports the following Chinese trigger words:

| Command | Meaning | Example |
|---------|---------|---------|
| 音乐播放 / 播放音乐 | Start playback | "音乐播放" |
| 暂停 / 暂停播放 | Pause playback | "暂停一下" |
| 下一曲 / 切歌 | Next track | "下一曲" |
| 上一曲 | Previous track | "上一曲" |
| 当前曲目 / 正在放什么 | View current track | "当前曲目" |

## Error Handling

All methods return a unified dictionary structure:

```python
{
    "success": True/False,
    "message": "Operation result description",
    "zone": "Zone name (optional)"
}
```

### Common Errors

- **Muspi zone not found**: Check if the Roon zone name ends with "muspi"
- **Failed to connect to Roon**: Ensure Roon Core is running and network-accessible
- **Token load failed**: First run requires authorization, ensure authorization completes successfully

## Notes

1. **First Run**: Extension authorization required in Roon, check for the extension authorization prompt in Roon interface
2. **Zone Naming**: Muspi zone names must end with "muspi" (case-insensitive)
3. **Token Storage**: Token is saved in `~/clawd/roon_config.json`, ensure secure file permissions
4. **Network Requirements**: The device running the script must be on the same network as Roon Core

## Technical Details

### Dependencies
- `roonapi>=0.1.6`: Official Roon API Python library

### Token Management
- Token storage path: `~/clawd/roon_config.json`
- Auto-load: Automatically loaded on each startup
- Auto-save: Automatically saved on first authorization or update

### Zone Finding Algorithm
```python
# Find all zones
zones = roon.zones

# Filter zones with muspi suffix
muspi_zones = [
    (zone_id, zone_data)
    for zone_id, zone_data in zones.items()
    if zone_data['display_name'].lower().endswith('muspi')
]

# Use the first matching zone
zone_id, zone_data = muspi_zones[0]
```

「设计创意」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。