managing-apple-music

TotalClaw 作者 totalclaw

通过“crawtunes” CLI 控制 macOS 上的 Apple Music(播放歌曲/专辑/播放列表,控制播放、音量、随机播放、重复、搜索、目录查找、AirPlay 和播放列表管理)。当用户要求播放音乐、搜索歌曲、控制音频播放或管理 Apple Music 设置时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~forketyfork-clawtunes
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~forketyfork-clawtunes/file -o forketyfork-clawtunes.md
# Apple Music CLI

Use `clawtunes` to control Apple Music from the terminal. Search and play music, control playback, adjust volume, manage playlists, manage shuffle/repeat, browse the Apple Music catalog, and connect to AirPlay devices.

Setup

- Install (Homebrew): `brew install forketyfork/tap/clawtunes`
- macOS-only; requires Apple Music app.

Play Music

- Play a song: `clawtunes play song "Song Name"`
- Play an album: `clawtunes play album "Album Name"`
- Play a playlist: `clawtunes play playlist "Playlist Name"`
- Always use the `--non-interactive` (`-N`) flag to prevent interactive prompts: `clawtunes -N play song "Song Name"`
- If the command exits with code 1 and lists multiple matches, retry with a more specific song/album/playlist name.
- If a more specific name still returns multiple matches, use the `--first` (`-1`) flag to auto-select the first result: `clawtunes -1 play song "Song Name"`

Playback Control

- Pause: `clawtunes pause`
- Resume: `clawtunes resume`
- Next track: `clawtunes next`
- Previous track: `clawtunes prev`
- Show now playing: `clawtunes status`

Volume

- Show volume: `clawtunes volume`
- Set volume: `clawtunes volume 50`
- Adjust volume: `clawtunes volume +10` or `clawtunes volume -10`
- Mute: `clawtunes mute`
- Unmute: `clawtunes unmute`

Shuffle and Repeat

- Enable/disable shuffle: `clawtunes shuffle on` or `clawtunes shuffle off`
- Set repeat mode: `clawtunes repeat off`, `clawtunes repeat all`, or `clawtunes repeat one`

Search

- Search songs and albums: `clawtunes search "query"`
- Include playlists: `clawtunes search "query" -p`
- Songs only: `clawtunes search "query" --no-albums`
- Limit results: `clawtunes search "query" -n 20`

Love/Dislike

- Love current track: `clawtunes love`
- Dislike current track: `clawtunes dislike`

Playlists

- List all playlists: `clawtunes playlists`
- Create a playlist: `clawtunes playlist create "Road Trip"`
- Add a song to a playlist: `clawtunes playlist add "Road Trip" "Kickstart My Heart"`
- Remove a song from a playlist: `clawtunes playlist remove "Road Trip" "Kickstart My Heart"`

AirPlay

- List devices: `clawtunes airplay`
- Select device: `clawtunes airplay "Device Name"`
- Deselect device: `clawtunes airplay "Device Name" --off`

Apple Music Catalog

- Search the streaming catalog: `clawtunes catalog search "Bowie Heroes"`
- Limit catalog results: `clawtunes catalog search "Bowie Heroes" -n 5`
- Note: Catalog search is browse-only. To add songs to playlists, they must first be in your library. Use Apple Music app to add catalog items to your library before managing them with clawtunes.

Notes

- macOS-only (uses AppleScript to communicate with Apple Music).
- If automation permissions are requested, grant access in System Settings > Privacy & Security > Automation.

---

## 中文说明

# Apple Music 命令行工具

使用 `clawtunes` 从终端控制 Apple Music。搜索并播放音乐、控制播放、调节音量、管理播放列表、管理随机播放/重复模式、浏览 Apple Music 目录,以及连接 AirPlay 设备。

设置

- 安装(Homebrew):`brew install forketyfork/tap/clawtunes`
- 仅支持 macOS;需要 Apple Music 应用。

播放音乐

- 播放歌曲:`clawtunes play song "Song Name"`
- 播放专辑:`clawtunes play album "Album Name"`
- 播放播放列表:`clawtunes play playlist "Playlist Name"`
- 始终使用 `--non-interactive`(`-N`)标志以避免交互式提示:`clawtunes -N play song "Song Name"`
- 如果命令以代码 1 退出并列出多个匹配项,请使用更具体的歌曲/专辑/播放列表名称重试。
- 如果使用更具体的名称仍返回多个匹配项,请使用 `--first`(`-1`)标志自动选择第一个结果:`clawtunes -1 play song "Song Name"`

播放控制

- 暂停:`clawtunes pause`
- 继续:`clawtunes resume`
- 下一曲:`clawtunes next`
- 上一曲:`clawtunes prev`
- 显示正在播放:`clawtunes status`

音量

- 显示音量:`clawtunes volume`
- 设置音量:`clawtunes volume 50`
- 调节音量:`clawtunes volume +10` 或 `clawtunes volume -10`
- 静音:`clawtunes mute`
- 取消静音:`clawtunes unmute`

随机播放与重复

- 启用/禁用随机播放:`clawtunes shuffle on` 或 `clawtunes shuffle off`
- 设置重复模式:`clawtunes repeat off`、`clawtunes repeat all` 或 `clawtunes repeat one`

搜索

- 搜索歌曲和专辑:`clawtunes search "query"`
- 包含播放列表:`clawtunes search "query" -p`
- 仅歌曲:`clawtunes search "query" --no-albums`
- 限制结果数量:`clawtunes search "query" -n 20`

喜欢/不喜欢

- 喜欢当前曲目:`clawtunes love`
- 不喜欢当前曲目:`clawtunes dislike`

播放列表

- 列出所有播放列表:`clawtunes playlists`
- 创建播放列表:`clawtunes playlist create "Road Trip"`
- 向播放列表添加歌曲:`clawtunes playlist add "Road Trip" "Kickstart My Heart"`
- 从播放列表移除歌曲:`clawtunes playlist remove "Road Trip" "Kickstart My Heart"`

AirPlay

- 列出设备:`clawtunes airplay`
- 选择设备:`clawtunes airplay "Device Name"`
- 取消选择设备:`clawtunes airplay "Device Name" --off`

Apple Music 目录

- 搜索流媒体目录:`clawtunes catalog search "Bowie Heroes"`
- 限制目录结果数量:`clawtunes catalog search "Bowie Heroes" -n 5`
- 注意:目录搜索仅供浏览。要将歌曲添加到播放列表,它们必须首先存在于你的资料库中。请先使用 Apple Music 应用将目录项添加到你的资料库,然后再用 clawtunes 管理它们。

注意事项

- 仅支持 macOS(使用 AppleScript 与 Apple Music 通信)。
- 如果系统请求自动化权限,请在“系统设置 > 隐私与安全性 > 自动化”中授予访问权限。