Spotify 2.0.3 plugin for Volumio 3 doesn't trigger mpc

Hi,

Normally a Music plugins contains a line like:

self.mpdPlugin = this.commandRouter.pluginManager.getPlugin('music_service', 'mpd');

I use this to monitor with mpc idle and mpc connect, to drive a OLED displaying the streaming source that is currently running. it’s working for other plugins, Tidal, Qobuz and local files.

It seems that spop doesn’t provide a status to MPC, can this be added?

Spop is the player. It does not use mpd nor mpc command.

Any possibility to track the status of Spop from terminal, without using a expensive loop on volumio status?

1 Like
volumio status

should help

volumio@volumio-rpi4:~$ volumio status
{
  "status": "play",
  "position": 0,
  "title": "Metal Heart",
  "artist": "Accept",
  "album": "Metal Heart",
  "albumart": "https://i.scdn.co/image/ab67616d0000b2732dde5a47131a2f833a80bd42",
  "uri": "spotify:track:3ZGajFLn8uAIpNxMxBwfGY",
  "trackType": "spotify",
  "seek": 5758,
  "duration": 324,
  "samplerate": "320Kbps",
  "bitdepth": "16 bit",
  "random": null,
  "repeat": null,
  "repeatSingle": false,
  "consume": false,
  "volume": 40,
  "dbVolume": null,
  "disableVolumeControl": false,
  "mute": false,
  "stream": "spotify",
  "volatile": false,
  "service": "spop"
}

Yes found that one.
Issue is that I can only poll it within a while True: loop. Causing functions like screensaver failing.

  • If I don’t use a loop the OLED will start blinking as every time it’s being called it creates a new object.
  • Can’t program it in Bash as the available commands (in Bash) are to limited to drive the OLED

Guess, No Spotify logo then, as it is the least used service for me now. (until they start delivering Hi-res)

Thanks anyway

Could you use the wrbsocket API? It’s event driven and no polling needed

1 Like

Listening to MPC (MPD) for state changes is a mistake, as you will receive status updates for mpd only, and not for TIDAL Connect, Spotify Connect and many other music sources.

Your best way would be to listen for websocket pushState event or poll via the REST API.

See:

Rest API,

Darn,…
Not sure why I didn’t come up with that one myself, both websockets and rest have notifications.
Will look into it.

:+1:

I suggest socket.io using pushState

You get notified on any change :wink: Fairly easy to implement.

Here’s an example:

var io=require('socket.io-client');
self.stateSocket= io.connect('http://localhost:3000');

self.stateSocket.on('connect', function() {
    self.stateSocket.emit('getState', '');
});


self.stateSocket.on('pushState', function (data) {
    // This is your state object
    var status = data.status; // play|stop|pause
});

Thanks,

Need some homework to do.

[Update]
It’s working!!

The result:

(updated picture)

1 Like