Player: GET /api/player with Spotify now-playing info

Source, state, artist/title/album, position and duration (from cspot's
playback state, so it matches the app), volume and `can`. cspot patch 0004
adds read getters for the playback state and context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 22:48:00 +10:00
parent c6ecbbeb25
commit 9e1ca98a5d
5 changed files with 117 additions and 4 deletions
+8
View File
@@ -42,6 +42,14 @@ void spotify_suspend(bool suspend);
void spotify_set_volume(int pct);
// A session is running (an app is connected to this device).
bool spotify_session_active(void);
typedef struct {
char artist[96], title[128], album[96]; // "" until the first track is audible
uint32_t duration_ms, position_ms; // position as the Spotify app sees it
bool paused;
} spotify_track_t;
// The current track of the running session. False without a session.
bool spotify_now_playing(spotify_track_t *t);
// Current state for status.spotify_state.
const char *spotify_state(void);