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
@@ -0,0 +1,14 @@
diff --git a/cspot/include/SpircHandler.h b/cspot/include/SpircHandler.h
index 7ff930b..c17caa0 100644
--- a/cspot/include/SpircHandler.h
+++ b/cspot/include/SpircHandler.h
@@ -44,6 +44,9 @@ class SpircHandler {
void subscribeToMercury();
std::shared_ptr<TrackPlayer> getTrackPlayer();
+ // Read access for the host (now-playing info: track position, play state).
+ std::shared_ptr<PlaybackState> getPlaybackState() { return playbackState; }
+ std::shared_ptr<cspot::Context> getContext() { return ctx; }
void setEventHandler(EventHandler handler);