librespot
librespot copied to clipboard
Implement some sort of State handler with some sort of RO-API
Is there a way to notice when a device connects / disconnects? and could we supply some kind of state file for tracking? what i have in mind is another argument to enable that feature and if enabled create a file where librespot writes the current state (like the proc file system on linux just a single line which gets updated on state changes) example content of that file:
Device connects: "connected"
Device disconnects: "noendpoint"
Device disconnects and no music playing or end of playlist: "noendpointnotplaying"
Agreed, this is a must have for the library given that it is going to be standalone. As per the gitter chat, here is a list of possible event emitters that it would be good to have:
- Track Start
- Track Finish
- Track Change
- Track Play
- Track Pause
- Track Stop
- Track Rewind/Fast Forward
- Track Seek Position
- Track Shuffle/Repeat enabled/disabled
- Device Connected [See above]
- Device Disconnected [See above]
- Device Disconnected no music [See above]
- Current Track Metadata
- Playlist Metadata [Track, Artist, Album, Duration]
- Queue updated
- Queue Metadata
- Volume Up/Down
I'm sure there are more, but I think this is more than good enough to start with.
Native Spotify clients seem to periodically report playback progress to their servers, maybe that's another possible event (some kind of a heartbeat).
There are also a couple error events, like not authorized (anymore), song not available in target market, too many requests, premium required, app key invalid/banned...
Good point, I forgot about the errors.