Volumio+Spotify Integration - Some Questions

Hi All,
I recently downloaded and compiled example code from libspotify on my RPi-B+, and it seems to play Spotify songs over ALSA without any problem. I’d like to look into developing some kind of Spotify integration to Volumio, and wanted some feedback.

The first implementation that comes to mind is a Spotify-playing daemon (call it “volumify” for the sake of argument) which runs in the background listening for Volumio control callbacks. When Volumio reaches an item in the playlist containing a Spotify URI, it directs volumify to buffer and play the track instead of using mpd. Would this be an acceptable way to hook into Volumio?

Thanks!

Hi! I am right now working on a spotify integration in Volumio. I’m doing something slightly different from you. I got a daemon in background, which is connected to spotify, and it listen on a websocket (same as mpd, but on different port).
Unfortunately we cannot just enqueue URI’s a let them play by spotify if they are not recognized by mpd, because all the backend relies on MPD.
I will be really glad if you could lend some help, just drop me a PM or a mail and we can make it happen!

Thanks Michelangelo! Well it looks like I need to post more in order to use the PM feature :wink: . What you’re saying makes sense. After digging a bit in the code, it seems that all the functionality for music library, playlists, and library updating is all done internally by MPD, with Volumio acting as a web-based control client. In this case, like you say, we probably need to tie directly into MPD. I would like to try and help!

If you could, please let me know what has been done already. Here’s a brain dump of what I can see so far:

  • The easiest way might be to make an external program that MPD can call as a generic decoder. One would embed a spotify URI into a file which represents one track, along with name, album, and length metadata so that MPD can display these. When MPD tries to play the file, it passes it via stdin to the decoder program, which then sends back the PCM audio data. MPD knows nothing about the playback position within the track, however. A different program will be needed to read a user’s Spotify playlists and generate/update these track files.
  • A harder but more elegant method would be to write an input plugin for MPD. Simon Kagstrom’s fork of the unmaintained Despotify can be used as an input plugin for MPD (if MPD is compiled with that option), but this fork is now also unmaintained. On an separate note, there seems to be a Despotify reboot called Respotify, but this does not work as an input plugin.

Hi Ning-yu,
I used successfully despotify with Mpd, but then API changed and despotify doesn’t work anymore. This was definetely the way to go, but unfortunately this cannot be used no more. I didn’t knew about the generic decoder option, that could make sense. But I think still the best way is to use a dedicated spotify daemon to control mpd . I will send you a PM on how we can carry this on :wink:

Good to see this is being actively worked upon. Thanks very much, and please keep us up to date with progress.