Spotify's AI DJ mode uses a special context type (lexicon_set_type: your_dj) that doesn't work with the standard context resolution. The current implementation fails because:
- DJ tracks have an empty
uri field in ContextTrack - the actual URI is in metadata["canonical_track_uri"]
- The context URL points to a session-specific lexicon endpoint that returns 404 from other sessions
- No transfer commands are sent for track advancement in DJ mode
I've got this working locally and am enjoying it now. My implementation does it like this:
- Adding
ContextTrackUri() helper that falls back to canonical_track_uri metadata
- Creating a single-track context from
TransferState.Playback.CurrentTrack for DJ transfers
- Caching
NextTracks from ClusterUpdate messages (the service broadcasts the full queue before transfer)
- Using the cached tracks to advance playback when a DJ track ends
- Skipping autoplay resolution for DJ contexts (that gives a 404)
I haven't looked at the TTS DJ-speak between tracks (I don't like that!) or the cross-fading between tracks (again, I dislike it, so didn't implement it).
Happy to commit a branch if there's interest in supporting this.
Spotify's AI DJ mode uses a special context type (
lexicon_set_type: your_dj) that doesn't work with the standard context resolution. The current implementation fails because:urifield inContextTrack- the actual URI is inmetadata["canonical_track_uri"]I've got this working locally and am enjoying it now. My implementation does it like this:
ContextTrackUri()helper that falls back tocanonical_track_urimetadataTransferState.Playback.CurrentTrackfor DJ transfersNextTracksfromClusterUpdatemessages (the service broadcasts the full queue before transfer)I haven't looked at the TTS DJ-speak between tracks (I don't like that!) or the cross-fading between tracks (again, I dislike it, so didn't implement it).
Happy to commit a branch if there's interest in supporting this.