CODEBLOCK0
"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
A gentle start to your day
CODEBLOCK1
- - Speaker: Sonos Move
- Volume: 40%
- Playlist: Morning Playlist
- Vibe: ☕ Coffee + good vibes
🎉 Party
Time to celebrate!
CODEBLOCK2
- - Speaker: ALL (Computer, MacBook, Sonos Move, Living Room TV)
- Volume: 70%
- Playlist: Rock Party Mix
- Vibe: 🤘 Neighbors hate this one trick
😌 Chill
Pure relaxation
CODEBLOCK3
- - Speaker: Sonos Move
- Volume: 30%
- Playlist: Chill Lounge
- Vibe: 🧘 Om...
🔇 Off
Silence
CODEBLOCK4
- - Pauses Spotify
- Disconnects all speakers
- Vibe: 🤫 Finally, peace and quiet
📊 Status
What's playing right now?
CODEBLOCK5
Shows:
- - Current Spotify track
- Connected speakers
🔧 Installation
CODEBLOCK6
Now home-music works from anywhere in your terminal! 🎉
🎨 Custom Playlists & Scenes
Changing Playlists
Open home-music.sh and find the playlist configuration:
CODEBLOCK7
How to find Playlist URIs:
- 1. 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:
CODEBLOCK8
Available Speakers
CODEBLOCK9
You can add any AirPlay speaker – they just need to be visible in Airfoil.
🐛 Troubleshooting
❌ "Speaker won't connect"
Check 1: Is Airfoil running?
CODEBLOCK10
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?
CODEBLOCK11
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?
CODEBLOCK13
Is spotify-applescript installed?
ls ~/clawd/skills/spotify-applescript/spotify.sh
❌ "Permission denied"
CODEBLOCK15
🔊 Direct Airfoil Commands
If you want to control Airfoil manually:
CODEBLOCK16
📁 Files
CODEBLOCK17
💡 Pro Tips
- 1. Set aliases for even faster access:
CODEBLOCK18
- 2. Use with Clawdbot:
> "Hey, start party mode"
> "Put on some chill music"
> "Stop the music"
- 3. Combine scenes: Create a
dinner scene with a jazz playlist at 25% – perfect for guests!
🐸 Credits
CODEBLOCK19
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. 🪰
♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
🏠 全 屋 音 乐 🎵
╔══════════════════════════════════════════╗
║ 全屋音乐场景 ║
║ 一条指令。所有音箱。完美。 ║
╚══════════════════════════════════════════╝
♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫ ♪ ♫
一条指令就能搞定的事,为什么要点17次? – 欧文 🐸
🎯 这个技能是做什么的?
Home Music 将 Spotify + Airfoil 整合成神奇的音乐场景。一条指令——就能让正确的歌单以完美的音量在正确的音箱上播放。
想象一下:
- - 你醒来 → home-music morning → 浴室里响起轻柔的旋律
- 朋友来了 → home-music party → 所有音箱播放摇滚乐
- 该放松了 → home-music chill → 到处是休闲氛围
- 一天结束 → home-music off → 安静。平和。宁静。
📋 依赖项
| 项目 | 用途 | 链接 |
|---|
| 🍏 macOS | 此技能使用 AppleScript | — |
| 🟢 Spotify 桌面应用 |
音乐来源!必须正在运行。 |
spotify.com |
| 📡
Airfoil | 将音频路由到 AirPlay 音箱 |
rogueamoeba.com |
| 🎵
spotify-applescript | 用于控制 Spotify 的 Clawdbot 技能 | skills/spotify-applescript/ |
⚠️ 重要提示: 启动任何场景前,必须确保 Spotify 和 Airfoil 都已运行!
🎬 场景
🌅 早晨
温柔地开启新的一天
bash
home-music morning
- - 音箱: Sonos Move
- 音量: 40%
- 歌单: 早晨歌单
- 氛围: ☕ 咖啡 + 好心情
🎉 派对
庆祝时刻!
bash
home-music party
- - 音箱: 全部(电脑、MacBook、Sonos Move、客厅电视)
- 音量: 70%
- 歌单: 摇滚派对混音
- 氛围: 🤘 邻居最讨厌这一招
😌 放松
纯粹的放松
bash
home-music chill
- - 音箱: Sonos Move
- 音量: 30%
- 歌单: 休闲酒廊
- 氛围: 🧘 唵...
🔇 关闭
安静
bash
home-music off
- - 暂停 Spotify
- 断开所有音箱
- 氛围: 🤫 终于,安静了
📊 状态
现在在播放什么?
bash
home-music status
显示:
🔧 安装
bash
使脚本可执行
chmod +x ~/clawd/skills/home-music/home-music.sh
创建全局符号链接
sudo ln -sf ~/clawd/skills/home-music/home-music.sh /usr/local/bin/home-music
现在 home-music 可以在终端的任何位置使用了!🎉
🎨 自定义歌单和场景
更改歌单
打开 home-music.sh 找到歌单配置:
bash
=== 歌单配置 ===
PLAYLIST_MORNING=spotify:playlist:19n65kQ5NEKgkvSAla5IF6
PLAYLIST_PARTY=spotify:playlist:37i9dQZF1DXaXB8fQg7xif
PLAYLIST_CHILL=spotify:playlist:37i9dQZF1DWTwnEm1IYyoj
如何找到歌单 URI:
- 1. 在 Spotify 中右键点击歌单
- 分享 → 复制 Spotify URI
- 或复制 URL 并提取 /playlist/ 部分
添加新场景
在 main 代码块中添加新的 case:
bash
在 home-music.sh 中,scene_chill 函数之后:
scene_workout() {
echo 💪 开始健身场景...
airfoilsetsource_spotify
airfoil_connect Sonos Move
sleep 0.5
airfoil_volume Sonos Move 0.8
$SPOTIFYCMD play spotify:playlist:YOURWORKOUT_PLAYLIST
$SPOTIFY_CMD volume 100
echo ✅ 健身:Sonos Move @ 80%,嗨起来!
}
在 case 代码块中:
workout)
scene_workout
;;
可用音箱
bash
ALL_SPEAKERS=(Computer Andys M5 Macbook Sonos Move Living Room TV)
你可以添加任何 AirPlay 音箱——只需它们在 Airfoil 中可见即可。
🐛 故障排除
❌ 音箱无法连接
检查 1: Airfoil 是否在运行?
bash
pgrep -x Airfoil || echo Airfoil 未运行!
检查 2: 音箱是否在网络中?
- - 打开 Airfoil 应用
- 检查音箱是否出现在列表中
- 尝试手动连接
检查 3: 名称是否完全正确?
- - 音箱名称区分大小写!
- 打开 Airfoil 并复制确切的名称
❌ 没有声音
检查 1: Spotify 是否在播放?
bash
~/clawd/skills/spotify-applescript/spotify.sh status
检查 2: Airfoil 音源是否正确?
- - 打开 Airfoil
- 检查是否选择了 Spotify 作为音频源
- 如果没有:点击 Source → 选择 Spotify
检查 3: 音箱音量?
bash
手动检查音量
osascript -e tell application Airfoil to get volume of (first speaker whose name is Sonos Move)
❌ Spotify 无法启动
Spotify 是否已打开?
bash
pgrep -x Spotify || open -a Spotify
spotify-applescript 是否已安装?
bash
ls ~/clawd/skills/spotify-applescript/spotify.sh
❌ 权限被拒绝
bash
chmod +x ~/clawd/skills/home-music/home-music.sh
🔊 直接 Airfoil 命令
如果你想手动控制 Airfoil:
bash
连接音箱
osascript -e tell application Airfoil to connect to (first speaker whose name is Sonos Move)
设置音箱音量 (0.0 - 1.0)
osascript -e tell application Airfoil to set (volume of (first speaker whose name is Sonos Move)) to 0.5
断开音箱
osascript -e tell application Airfoil to disconnect from (first speaker whose name is Sonos Move)
列出已连接音箱
osascript -e tell application Airfoil to get name of every speaker whose connected is true
设置音频源
osascript -e tell application Airfoil
set theSource to (first application source whose name contains Spotify)
set current audio source to theSource
end tell
📁 文件
skills/home-music/
├── SKILL.md # 本文档
└── home-music.sh # 主脚本
💡 专业技巧
- 1. 设置别名 以便更快访问:
bash
alias mm=home-music morning
alias mp=home-music party
alias mc=home-music chill
alias mo=home-music off
- 2. 与 Clawdbot 配合使用:
> 嘿,启动派对模式
> 放点放松的音乐
> 停止音乐
3