一键掌控全屋音乐场景
简介
基于 AppleScript 的 macOS 全屋音乐场景控制器,整合 Spotify 与 Airfoil 实现一键切换晨间/派对/放松模式,让多房间音响管理化繁为简。
原始描述
Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes.
通过你的 Agent 添加
安装目录:home-music/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Home Music 是一款专为 macOS 设计的全屋音乐场景自动化工具,通过整合 Spotify 桌面应用与 Airfoil 音频路由软件,实现"一句话控制全屋音响"的体验。用户只需输入 home-music morning、、home-music party或 home-music chill` 等简单命令,即可自动完成播放列表切换、目标扬声器选择、音量调节等一系列操作。
该技能采用 Bash 脚本 + AppleScript 的混合架构,底层通过 osascript 与 Airfoil 应用通信,控制音频源选择和扬声器连接,同时调用 spotify-applescript 技能管理 Spotify 的播放状态。预设场景包括:晨间模式(Sonos Move 单音箱、40% 音量、咖啡氛围)、派对模式(全屋所有音箱、70% 音量、摇滚歌单)、放松模式(单音箱、30% 音量、 lounge 音乐)以及静音模式。
显著优点
- 极致简化操作:将原本需要 10+ 次点击的多步骤操作压缩为单一命令,大幅降低全屋音乐系统的使用门槛。
- 场景化设计:预设模式覆盖常见生活场景,用户无需记忆复杂的设备名称和音量参数。
- 高度可定制:支持修改播放列表 URI、添加自定义场景(如健身、晚餐)、配置任意 AirPlay 音箱,满足个性化需求。
- 文档完善:从安装配置到故障排查,SKILL.md 提供了详尽的指导,包括直接可用的 AppleScript 代码片段供高级用户手动调试。
- 本地优先:所有控制均在本地完成,无网络依赖,响应速度快且隐私风险极低。
潜在缺点与局限性
- 平台锁定严重:仅支持 macOS,Windows 和 Linux 用户无法使用;依赖 AppleScript 这一苹果专有技术。
- 外部依赖复杂:必须同时安装并运行 Spotify 桌面应用、Airfoil 商业软件以及
spotify-applescript 技能,任一环节故障都会导致整体失效。
- 硬件成本:Airfoil 为付费软件(Rogue Amoeba 出品),且需要支持 AirPlay 的音箱设备,入门门槛较高。
- 无远程控制能力:纯本地架构意味着无法通过手机 App 或网络远程触发场景,必须在 Mac 终端或配合 Clawdbot 使用。
- 错误处理有限:虽然使用了
set -euo pipefail,但部分 AppleScript 调用失败时仅静默忽略(|| true),可能导致场景"部分生效"而用户无感知。
适合的目标群体
- macOS 重度用户:已深度融入苹果生态,拥有多台 AirPlay 音箱的家庭。
- 智能家居爱好者:追求自动化体验,愿意通过终端/语音助手控制家居环境的技术早期采用者。
- Spotify + Airfoil 现有用户:已购买并配置好相关软件,希望进一步提升使用效率的人群。
- 开发者/极客:具备 Bash 和 AppleScript 基础,能够根据文档自行扩展自定义场景的用户。
使用风险
- 依赖项失效风险:Spotify 或 Airfoil 的更新可能破坏 AppleScript 接口兼容性,导致技能突然失效。
- 音箱连接不稳定:AirPlay 设备在网络波动时可能出现连接失败,脚本虽会尝试重连但无持久化状态管理。
- 音量突变风险:场景切换时音量可能从 30% 跳变至 70%,若用户未预期可能造成惊吓或扰民。
- 权限累积:长期使用
osascript 控制应用可能导致系统积累大量辅助功能权限,存在潜在的权限管理混乱风险。
- 平台锁定严重:仅支持 macOS,Windows 和 Linux 用户无法使用;依赖 AppleScript 这一苹果专有技术。
- 外部依赖复杂:必须同时安装并运行 Spotify 桌面应用、Airfoil 商业软件以及
spotify-applescript技能,任一环节故障都会导致整体失效。 - 硬件成本:Airfoil 为付费软件(Rogue Amoeba 出品),且需要支持 AirPlay 的音箱设备,入门门槛较高。
- 无远程控制能力:纯本地架构意味着无法通过手机 App 或网络远程触发场景,必须在 Mac 终端或配合 Clawdbot 使用。
- 错误处理有限:虽然使用了
set -euo pipefail,但部分 AppleScript 调用失败时仅静默忽略(|| true),可能导致场景"部分生效"而用户无感知。
适合的目标群体
- macOS 重度用户:已深度融入苹果生态,拥有多台 AirPlay 音箱的家庭。
- 智能家居爱好者:追求自动化体验,愿意通过终端/语音助手控制家居环境的技术早期采用者。
- Spotify + Airfoil 现有用户:已购买并配置好相关软件,希望进一步提升使用效率的人群。
- 开发者/极客:具备 Bash 和 AppleScript 基础,能够根据文档自行扩展自定义场景的用户。
使用风险
- 依赖项失效风险:Spotify 或 Airfoil 的更新可能破坏 AppleScript 接口兼容性,导致技能突然失效。
- 音箱连接不稳定:AirPlay 设备在网络波动时可能出现连接失败,脚本虽会尝试重连但无持久化状态管理。
- 音量突变风险:场景切换时音量可能从 30% 跳变至 70%,若用户未预期可能造成惊吓或扰民。
- 权限累积:长期使用
osascript 控制应用可能导致系统积累大量辅助功能权限,存在潜在的权限管理混乱风险。
- 依赖项失效风险:Spotify 或 Airfoil 的更新可能破坏 AppleScript 接口兼容性,导致技能突然失效。
- 音箱连接不稳定:AirPlay 设备在网络波动时可能出现连接失败,脚本虽会尝试重连但无持久化状态管理。
- 音量突变风险:场景切换时音量可能从 30% 跳变至 70%,若用户未预期可能造成惊吓或扰民。
- 权限累积:长期使用
osascript控制应用可能导致系统积累大量辅助功能权限,存在潜在的权限管理混乱风险。
技能正文
name: home-music description: Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes. homepage: local metadata: {"clawdbot":{"emoji":"🏠","os":["darwin"]}} triggers:
- music scene
- morning music
- party mode
- chill music
- house music
- stop music
♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
🏠 H O M E M U S I C 🎵
╔══════════════════════════════════════════╗
║ Whole-House Music Scenes ║
║ One command. All speakers. Perfect. ║
╚══════════════════════════════════════════╝
♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
"Why click 17 times when one command does the job?" – Owen 🐸
🎯 What Does This Skill Do?
Home Music combines Spotify + Airfoil into magical music scenes. One command – and the right playlist plays on the right speakers at the perfect volume.
Imagine:
- You wake up →
home-music morning→ Gentle tunes in the bathroom - Friends arrive →
home-music party→ All speakers blasting rock - Time to relax →
home-music chill→ Lounge vibes everywhere - Done for the day →
home-music off→ Silence. Peace. Serenity.
📋 Dependencies
What
Why
Link
🍏 macOS
This skill uses AppleScript
—
🟢 Spotify Desktop App
The music source! Must be running.
spotify.com
📡 Airfoil
Routes audio to AirPlay speakers
rogueamoeba.com
🎵 spotify-applescript
Clawdbot skill for Spotify control
skills/spotify-applescript/
⚠️ Important: Both Spotify and Airfoil must be running before you start any scenes!
🎬 Scenes
🌅 Morning
| What | Why | Link |
|---|---|---|
| 🍏 macOS | This skill uses AppleScript | — |
| 🟢 Spotify Desktop App | The music source! Must be running. | spotify.com |
| 📡 Airfoil | Routes audio to AirPlay speakers | rogueamoeba.com |
| 🎵 spotify-applescript | Clawdbot skill for Spotify control | skills/spotify-applescript/ |
⚠️ Important: Both Spotify and Airfoil must be running before you start any scenes!
🌅 Morning
A gentle start to your day
home-music morning
- Speaker: Sonos Move
- Volume: 40%
- Playlist: Morning Playlist
- Vibe: ☕ Coffee + good vibes
🎉 Party
Time to celebrate!
home-music party
- Speaker: ALL (Computer, MacBook, Sonos Move, Living Room TV)
- Volume: 70%
- Playlist: Rock Party Mix
- Vibe: 🤘 Neighbors hate this one trick
😌 Chill
Pure relaxation
home-music chill
- Speaker: Sonos Move
- Volume: 30%
- Playlist: Chill Lounge
- Vibe: 🧘 Om...
🔇 Off
Silence
home-music off
- Pauses Spotify
- Disconnects all speakers
- Vibe: 🤫 Finally, peace and quiet
📊 Status
What's playing right now?
home-music status
Shows:
- Current Spotify track
- Connected speakers
🔧 Installation
# Make the script executable
chmod +x ~/clawd/skills/home-music/home-music.sh
# Symlink for global access
sudo ln -sf ~/clawd/skills/home-music/home-music.sh /usr/local/bin/home-music
# Make the script executable
chmod +x ~/clawd/skills/home-music/home-music.sh
# Symlink for global access
sudo ln -sf ~/clawd/skills/home-music/home-music.sh /usr/local/bin/home-music
Now home-music works from anywhere in your terminal! 🎉
🎨 Custom Playlists & Scenes
Changing Playlists
Open home-music.sh and find the playlist configuration:
# === PLAYLIST CONFIGURATION ===
PLAYLIST_MORNING="spotify:playlist:19n65kQ5NEKgkvSAla5IF6"
PLAYLIST_PARTY="spotify:playlist:37i9dQZF1DXaXB8fQg7xif"
PLAYLIST_CHILL="spotify:playlist:37i9dQZF1DWTwnEm1IYyoj"
How to find Playlist URIs:
- Right-click on a playlist in Spotify
- "Share" → "Copy Spotify URI"
- Or copy the URL and extract the
/playlist/part
Adding a New Scene
Add a new case in the main block:
# In home-music.sh after the "scene_chill" function:
scene_workout() {
echo "💪 Starting Workout scene..."
airfoil_set_source_spotify
airfoil_connect "Sonos Move"
sleep 0.5
airfoil_volume "Sonos Move" 0.8
"$SPOTIFY_CMD" play "spotify:playlist:YOUR_WORKOUT_PLAYLIST"
"$SPOTIFY_CMD" volume 100
echo "✅ Workout: Sonos Move @ 80%, Pump it up!"
}
# And in the case block:
workout)
scene_workout
;;
Available Speakers
ALL_SPEAKERS=("Computer" "Andy's M5 Macbook" "Sonos Move" "Living Room TV")
ALL_SPEAKERS=("Computer" "Andy's M5 Macbook" "Sonos Move" "Living Room TV")
You can add any AirPlay speaker – they just need to be visible in Airfoil.
🐛 Troubleshooting
❌ "Speaker won't connect"
Check 1: Is Airfoil running?
pgrep -x Airfoil || echo "Airfoil is not running!"
Check 2: Is the speaker on the network?
- Open the Airfoil app
- Check if the speaker appears in the list
- Try connecting manually
Check 3: Is the name exactly correct?
- Speaker names are case-sensitive!
- Open Airfoil and copy the exact name
❌ "No sound"
Check 1: Is Spotify playing?
~/clawd/skills/spotify-applescript/spotify.sh status
Check 2: Is the Airfoil source correct?
- Open Airfoil
- Check if "Spotify" is selected as the audio source
- If not: Click "Source" → Select Spotify
Check 3: Speaker volume?
# Manually check volume
osascript -e 'tell application "Airfoil" to get volume of (first speaker whose name is "Sonos Move")'
❌ "Spotify won't start"
Is Spotify open?
pgrep -x Spotify || open -a Spotify
Is spotify-applescript installed?
ls ~/clawd/skills/spotify-applescript/spotify.sh
❌ "Permission denied"
chmod +x ~/clawd/skills/home-music/home-music.sh
🔊 Direct Airfoil Commands
chmod +x ~/clawd/skills/home-music/home-music.sh
If you want to control Airfoil manually:
# Connect a speaker
osascript -e 'tell application "Airfoil" to connect to (first speaker whose name is "Sonos Move")'
# Set speaker volume (0.0 - 1.0)
osascript -e 'tell application "Airfoil" to set (volume of (first speaker whose name is "Sonos Move")) to 0.5'
# Disconnect a speaker
osascript -e 'tell application "Airfoil" to disconnect from (first speaker whose name is "Sonos Move")'
# List connected speakers
osascript -e 'tell application "Airfoil" to get name of every speaker whose connected is true'
# Set audio source
osascript -e 'tell application "Airfoil"
set theSource to (first application source whose name contains "Spotify")
set current audio source to theSource
end tell'
📁 Files
skills/home-music/
├── SKILL.md # This documentation
└── home-music.sh # The main script
💡 Pro Tips
-
Set aliases for even faster access:
alias mm="home-music morning"
alias mp="home-music party"
alias mc="home-music chill"
alias mo="home-music off"
-
Use with Clawdbot:
"Hey, start party mode"
"Put on some chill music"
"Stop the music"
-
Combine scenes: Create a dinner scene with a jazz playlist at 25% – perfect for guests!
🐸 Credits
╭─────────────────────────────────────────────╮
│ │
│ Crafted with 💚 by Owen the Frog 🐸 │
│ │
│ "Ribbit. Music makes everything better." │
│ │
╰─────────────────────────────────────────────╯
skills/home-music/
├── SKILL.md # This documentation
└── home-music.sh # The main script
-
Set aliases for even faster access:
alias mm="home-music morning" alias mp="home-music party" alias mc="home-music chill" alias mo="home-music off" -
Use with Clawdbot:
"Hey, start party mode" "Put on some chill music" "Stop the music"
-
Combine scenes: Create a
dinnerscene with a jazz playlist at 25% – perfect for guests!
🐸 Credits
╭─────────────────────────────────────────────╮
│ │
│ Crafted with 💚 by Owen the Frog 🐸 │
│ │
│ "Ribbit. Music makes everything better." │
│ │
╰─────────────────────────────────────────────╯
╭─────────────────────────────────────────────╮
│ │
│ Crafted with 💚 by Owen the Frog 🐸 │
│ │
│ "Ribbit. Music makes everything better." │
│ │
╰─────────────────────────────────────────────╯
Author: Andy Steinberger (with help from his Clawdbot Owen the Frog 🐸)
Version: 1.0.0
License: MIT
Pond: The one with the water lilies 🪷
Did this skill improve your life? Owen appreciates flies. 🪰
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。