ClawSkills logoClawSkills

Airfoil

通过命令行使用 Airfoil 控制 AirPlay 扬声器。使用简单的 CLI 命令进行连接、断开连接、设置音量和管理多房间音频。

介绍

# 🔊 Airfoil Skill

``` ╔═══════════════════════════════════════════════════════════╗ ║ ║ ║ 🎵 A I R F O I L S P E A K E R C O N T R O L 🎵 ║ ║ ║ ║ Stream audio to any AirPlay speaker ║ ║ from your Mac via CLI ║ ║ ║ ╚═══════════════════════════════════════════════════════════╝ ```

> *"既然可以直接对它呱呱叫,何必还要跳到 Mac 上呢?"* 🐸

---

## 📖 这个技能有什么用?

**Airfoil 技能** 让你可以直接从终端——或者通过 Clawd——完全控制你的 AirPlay 扬声器。连接扬声器、控制音量、检查状态——所有这些都无需触碰鼠标。

**功能:** - 📡 **列出 (List)** — 显示所有可用扬声器 - 🔗 **连接 (Connect)** — 连接到扬声器 - 🔌 **断开 (Disconnect)** — 断开扬声器连接 - 🔊 **音量 (Volume)** — 控制音量 (0-100%) - 📊 **状态 (Status)** — 显示已连接扬声器及其音量级别

---

## ⚙️ 要求

| 项目 | 详情 | |------|---------| | **操作系统** | macOS (使用 AppleScript) | | **应用** | Rogue Amoeba 出品的 [Airfoil](https://rogueamoeba.com/airfoil/mac/) | | **价格** | $35 (提供免费试用) |

### 安装

1. **安装 Airfoil:** ```bash # Via Homebrew brew install --cask airfoil # Or download from rogueamoeba.com/airfoil/mac/ ```

2. **启动 Airfoil** 并授予辅助功能权限 (系统设置 → 隐私与安全性 → 辅助功能)

3. **准备就绪!** 🚀

---

## 🛠️ 命令

### `list` — 显示所有扬声器

```bash ./airfoil.sh list ```

**输出:** ``` Computer, Andy's M5 Macbook, Sonos Move, Living Room TV ```

---

### `connect <speaker>` — 连接到扬声器

```bash ./airfoil.sh connect "Sonos Move" ```

**输出:** ``` Connected: Sonos Move ```

> 💡 扬声器名称必须完全匹配 (区分大小写!)

---

### `disconnect <speaker>` — 断开扬声器连接

```bash ./airfoil.sh disconnect "Sonos Move" ```

**输出:** ``` Disconnected: Sonos Move ```

---

### `volume <speaker> <0-100>` — 设置音量

```bash # Set to 40% ./airfoil.sh volume "Sonos Move" 40

# Set to maximum ./airfoil.sh volume "Living Room TV" 100

# Quiet mode for night time ./airfoil.sh volume "Sonos Move" 15 ```

**输出:** ``` Volume Sonos Move: 40% ```

---

### `status` — 显示已连接扬声器

```bash ./airfoil.sh status ```

**输出:** ``` Sonos Move: 40% Living Room TV: 65% ```

或者如果未连接任何设备: ``` No speakers connected ```

---

## 🎯 示例工作流

### 🏠 "客厅音乐" ```bash ./airfoil.sh connect "Sonos Move" ./airfoil.sh volume "Sonos Move" 50 # → Now fire up Spotify/Apple Music and enjoy! ```

### 🎬 "电影之夜设置" ```bash ./airfoil.sh connect "Living Room TV" ./airfoil.sh volume "Living Room TV" 70 ./airfoil.sh disconnect "Sonos Move" # If still connected ```

### 🌙 "全部关闭" ```bash for speaker in "Sonos Move" "Living Room TV"; do ./airfoil.sh disconnect "$speaker" 2>/dev/null done echo "All speakers disconnected 🌙" ```

---

## 🔧 故障排除

### ❌ "找不到扬声器"

**问题:** `execution error: Airfoil got an error: Can't get speaker...`

**解决方案:** 1. 检查拼写是否准确:`./airfoil.sh list` 2. 扬声器名称 **区分大小写** ("sonos move" ≠ "Sonos Move") 3. 扬声器必须在同一网络中 4. 扬声器必须已开机且可达

---

### ❌ "Airfoil 无法启动 / 无权限"

**问题:** AppleScript 无法控制 Airfoil

**解决方案:** 1. **系统设置 → 隐私与安全性 → 辅助功能** 2. 添加终端 (或 iTerm) 3. 添加 Airfoil 4. 重启 macOS (有时是必要的 🙄)

---

### ❌ "音量控制无效"

**问题:** 音量命令没有任何效果

**解决方案:** 1. 必须先 **连接** 扬声器才能设置音量 2. 先 `connect`,然后 `volume` 3. 部分扬声器具有硬件端限制

---

### ❌ "未安装 Airfoil"

**问题:** `execution error: Application isn't running`

**解决方案:** ```bash # Start Airfoil open -a Airfoil

# Or install it brew install --cask airfoil ```

---

### ❌ "bc: command not found"

**问题:** 音量计算失败

**解决方案:** ```bash # Install bc (should be standard on macOS) brew install bc ```

---

## 📋 已知扬声器

以下扬声器已经过测试:

| 扬声器 | 类型 | 备注 | |---------|------|-------| | `Computer` | 本地 | 始终可用 | | `Andy's M5 Macbook` | Mac | 当处于网络中时 | | `Sonos Move` | Sonos | 蓝牙或 WiFi | | `Living Room TV` | Apple TV | 通过 AirPlay |

> 💡 使用 `./airfoil.sh list` 来发现你自己的扬声器!

---

## 🔗 与 Clawd 集成

此技能与 Clawd 完美配合!示例:

``` "Hey Clawd, connect the Sonos Move" → ./airfoil.sh connect "Sonos Move"

"Turn the music down" → ./airfoil.sh volume "Sonos Move" 30

"Which speakers are on?" → ./airfoil.sh status ```

---

## 📜 更新日志

| 版本 | 日期 | 更改 | |---------|------|---------| | 1.0.0 | 2025-01-25 | 初始发布 | | 1.1.0 | 2025-06-10 | 文档润色 🐸 | | 1.2.0 | 2025-06-26 | 翻译成英文,已适配 ClawdHub!|

---

## 🐸 致谢

``` @..@ (----) ( >__< ) "This skill was crafted with love ^^ ^^ by a frog and his human!" ```

**作者:** Andy Steinberger (在他的 Clawdbot Owen the Frog 的帮助下 🐸) **由以下技术支持:** Rogue Amoeba 出品的 [Airfoil](https://rogueamoeba.com/airfoil/mac/) **属于:** [Clawdbot](https://clawdhub.com) 技能集

---

<div align="center">

**为 Clawdbot 社区用 💚 制作**

*呱呱!* 🐸

</div>

更多产品