Skip to content

Conversation

@STop211650
Copy link

Summary

  • Add Apple Music search and playback support for Sonos speakers
  • Authentication via browser-extracted tokens (~6 month lifespan)
  • Enqueue content via Sonos SMAPI for seamless playback

New Commands

  • sonos auth applemusic login/status/logout - Token management
  • sonos search applemusic <query> - Search Apple Music catalog
  • sonos play applemusic <query> - Search and play on Sonos

Files Added

Path Description
internal/applemusic/ Apple Music API client, auth flow, token storage
internal/cli/auth_applemusic.go Auth CLI commands
internal/cli/search_applemusic.go Search CLI command
internal/cli/play_applemusic.go Play CLI command
internal/sonos/applemusic.go URL parsing, Sonos enqueue logic
docs/applemusic.md Detailed documentation

Authentication

Tokens are extracted from the Apple Music web player:

  1. Sign in at https://music.apple.com
  2. Open Developer Tools → Console
  3. Run MusicKit.getInstance().developerToken and MusicKit.getInstance().musicUserToken
  4. Paste tokens when prompted by sonos auth applemusic login

Prerequisites

  • Apple Music must be linked in the Sonos app
  • Active Apple Music subscription

🤖 Generated with Claude Code

Shyam Toprani and others added 2 commits January 7, 2026 13:49
Add support for searching and playing Apple Music content on Sonos speakers:

- Search Apple Music catalog (songs, albums, playlists, artists)
- Play Apple Music content directly on Sonos speakers
- Authentication via browser-extracted tokens (~6 month lifespan)
- Enqueue via Sonos SMAPI for seamless playback

New commands:
- `sonos auth applemusic login/status/logout` - Token management
- `sonos search applemusic <query>` - Search Apple Music
- `sonos play applemusic <query>` - Search and play on Sonos

Requires Apple Music to be linked in the Sonos app.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use service 52231 for DIDL metadata descriptors (not 204)
- Add proper item ID prefixes (10032020 for tracks, 1004206c for albums)
- URL-encode colons in item IDs to match Sonos format

This fixes queue display showing "Q:0/1" instead of track titles.
The URI uses sid=204 for routing, but metadata needs service 52231.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant