apple-music

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Apple Music

Apple Music

Control Apple Music via MusicKit API and AppleScript. Path:
~/.clawdbot/skills/apple-music/
通过MusicKit API和AppleScript控制Apple Music。路径:
~/.clawdbot/skills/apple-music/

Local (No Setup)

本地模式(无需配置)

Playback:
./apple-music.sh player [now|play|pause|toggle|next|prev|shuffle|repeat|volume N|song "name"]

AirPlay:
./apple-music.sh airplay [list|select N|add N|remove N]
播放控制:
./apple-music.sh player [now|play|pause|toggle|next|prev|shuffle|repeat|volume N|song "name"]

AirPlay控制:
./apple-music.sh airplay [list|select N|add N|remove N]

API (Setup Required)

API模式(需配置)

Requires Apple Developer account ($99/yr) + MusicKit key.
需要Apple开发者账号(年费99美元)及MusicKit密钥。

Setup

配置步骤

Portal steps first:
  1. developer.apple.com → Keys → Create MusicKit key → Download .p8
  2. Note your Key ID and Team ID
Then run setup:
bash
./launch-setup.sh  # Opens Terminal for interactive setup
The launcher opens Terminal.app and runs the setup script there. Enter your .p8 path, Key ID, Team ID, then authorize in browser and paste the token.
⚠️ Agents: Always use
./launch-setup.sh
to open Terminal. Don't run setup.sh through chat (requires interactive input).
首先完成开发者门户操作:
  1. 访问developer.apple.com → 密钥 → 创建MusicKit密钥 → 下载.p8文件
  2. 记录你的密钥ID(Key ID)和团队ID(Team ID)
然后运行配置脚本:
bash
./launch-setup.sh  # 打开终端进行交互式配置
启动器会打开Terminal.app并在其中运行配置脚本。输入你的.p8文件路径、Key ID、Team ID,然后在浏览器中完成授权并粘贴令牌。
⚠️ Agent注意: 请始终使用
./launch-setup.sh
打开终端。请勿通过聊天窗口直接运行setup.sh(该脚本需要交互式输入)。

Commands

命令列表

  • search "query" [--type songs|albums|artists] [--limit N]
  • library add <song-id>
  • playlists [list|create "Name"|add <playlist-id> <song-id>]
  • search "query" [--type songs|albums|artists] [--limit N]
  • library add <song-id>
  • playlists [list|create "Name"|add <playlist-id> <song-id>]

Config

配置文件

config.json
stores tokens (valid ~6 months). Re-run
./setup.sh
if auth fails.
config.json
存储令牌(有效期约6个月)。如果授权失败,请重新运行
./setup.sh

Errors

错误排查

  • 401: Token expired, re-run setup
  • 403: Check Apple Music subscription
  • 404: Invalid ID or region-locked
  • 401:令牌过期,重新运行配置脚本
  • 403:检查Apple Music订阅状态
  • 404:ID无效或内容受区域限制

Setup Issues

配置问题解决

  • 404 on auth page: Setup script auto-fixes with HTTP server verification
  • No token in browser: Restart setup.sh
  • Browser won't open: Manually open printed URL (Chrome recommended)
  • 授权页面显示404: 配置脚本会通过HTTP服务器验证自动修复该问题
  • 浏览器中无令牌显示: 重启setup.sh
  • 浏览器无法打开: 手动打开打印的URL(推荐使用Chrome)