Volumio 1.55 with Spotify thoughts.

got a new Raspberry Pi 2 the other week. Installed Volumio 1.55 for the first time.

Having replaced SD card for faster one and increase cache size the playback is now very good (no cut outs).

Given Spotify have still not released the Connect API, I mainly use 2 Android phones to listen and control in multi-rooms (via the connect system). Installed Volumio to see what it would be like controlling playback through Pi from phone. Comments as follows.

  1. main issue is the way Volumio presents temporary spotify playlists or lack of. I can select a playlist and then add tracks to a Volumio playlist but I can’t see this temp playlist other than a [current track / total track] numeric system. Are there plans to be able to see and control the temporary playlists?

  2. no way to crossfade tracks like in Spotify interface. This is very useful for when playing mix albums.

  3. no way to search for artist and get list of albums and add entire album to playlist in one click. I have to add all tracks manually.

appreciate your Spotify implementation is still new so looking forward to more improvements. Keep up the good work.

  1. Yes, the Volumio play queue is a direct interface to the MPD play queue. Unfortunately MPD has no idea what to do with Spotify tracks.
  2. You might request crossfade support in Spop Github. We don’t currently have plans to implement this, but will definitely consider it if lots of people want it. :slight_smile:
  3. Yes that is unfortunately the case.

To put this in context, the current implementation of Spotify playback in Volumio was intended from the beginning to be a temporary patch solution. We are working hard on a full implementation, which will give Volumio its own state machine and play queue, along with lots of other good things, to be announced later. :wink:

hey guys, thought I’d contribute my 2 cents: I’ve been loving the new spotify support in volumio, but like cygnusx notes, there are a few things missing… so I had a google today and found the following

github.com/Schnouki/spop#commands

These ^^ are the commands that can be sent to the spop daemon, with which you can accomplish a lot of what you’re asking cygnusx. I’ve just started working on it (and will propably be finished oh i donno, around 2043), but here are some of the functionality I see as possible:

  1. search for albums and artists:
  • At the moment the function querySpopDB() in inc/player_lib.php handles spotify searches by calling the function _searchSpopTracks(). This function however actually receives albums as well as tracks from the spotify servers, but chooses to only parse and return tracks
  • So, by modifying this function or writing two new ones to deal with artists and albums, you can easily return such items as well
  1. adding entire albums or artists collections:
  • Each artist, album and track has it’s own play URI which is returned in searches as mentioned above
  • So, as long as you have a search function that returns artists and album objects, they can be added to the playback queue in THE EXACT SAME WAY as a track by using the ‘uadd’ command for spop, ie. you wouldn’t even need to write a new function for this…
  1. handling spotify playback queue:
  • the spop command ‘qls’ will list the contents of the spotify queue
  • i wrote this function in inc/player_lib.php…

[code]function getSpopQueue($sock){
$arrayReturn = array();
$arrayResponse = sendSpopCommand($sock,“qls”);

$i = 0;
$nItems = sizeof($arrayResponse["tracks"]);
while ($i < $nItems) {
	$arrayCurrentEntry = array();
	$arrayCurrentEntry["TrackNumber"] = (string) $i;
	$arrayCurrentEntry["Title"] = $arrayResponse["tracks"][$i]["title"];
	$arrayCurrentEntry["Artist"] = $arrayResponse["tracks"][$i]["artist"];
	$arrayCurrentEntry["Album"] = $arrayResponse["tracks"][$i]["album"];

	array_push($arrayReturn, $arrayCurrentEntry);

	$i++;
}

return $arrayReturn;

}[/code]
… which returns an array with the queue (including each items TrackNumber) to db/index.php…

[code] case ‘getspotifyqueue’:
$spotifyqueue=array();

				if ($spop) {
					$spotifyqueue = getSpopQueue($spop);
				} else {
					$spotifyqueue[]='No spotify connection open.';
				}

				echo json_encode($spotifyqueue);

				

			break;[/code]

… which echo’s the data in json format back to the calling js/volumio.playback.js where I mean write a function to print the queue to the “Queue” tab every time something is changed with respect to spotify playback (ie. requerying the whole thing every time instead of trying to keep it synced on the client side by adding/removing one item at a time “manually”).

The fact that we get the TrackNumber means we can then remove items from the queue by calling the spop command ‘qrm’.

Being able to manipulate the playback queue means you can use the android app “Volumio Spotify Share” to let people (not just the person with the spotify account on volumio) send a playlist to spotify and then actually be able to see what’s gonna be played and change it (the way it works today where u just send an entire playlist is and then have no control beyond skipping to the next song feels kind of limited).

So, these 3 steps will basically give you the same functionality with spotify as with MPD.

Yup that’s correct, most of the commands required for the above mentioned functionality are present in Spop. The only thing required is time to get them working! :slight_smile:

We found that, with the current PHP codebase, it is difficult to make large functionality improvements to in an efficient way. For that reason, we are beginning to migrate everything to a faster framework which is also easier to expand and maintain. That being said, I’d be happy to have your help improving our current Spotify implementation, or let me know if you’re interested in helping to work on what’s coming up! Just PM me or Michelangelo. :wink:

Wow, with this helpful info I’ve been able to add spotify playlist support when spop is active (playing/paused) and add a ‘play’ icon to the item currently being played for both MPD and SPOP. Also I added albums to the search results, it seems to work…

Awesome find x7dude! Thanks a million.

The files I had to edit were:

/command/index.php
/db/index.php
/inc/player_lib.php
/js/volumio.api.js
/js/volumio/playback.js

You can now:

  • search albums on spotify
  • view clearly which song is playing in the playlist
  • view the spotify play queue

Someone with more JavaScript experience might do a better job, but it works for now. :slight_smile:

I added the file to this post, I don’t believe v1.55 is still being maintained, but hey someone like myself could use 'em.

UPDATE (also uploaded new zip containing the below updates):

  • albums now have a white Spotify icon
  • delete from playback queue for spop items added
    volumio.update.zip (38.7 KB)

Hi!
spotify-volumio-t6375.html#p33301
But some times i so
Connecting…

Only in mozilla (
Chrome Dont work

But allways Connecting… confused! (

I presume you are running Volumio on a raspberry pi? Which version are you using?

What did you do exactly? Install the image and copy over the zip I provided? Or did you do more?

Are you controlling Volumio with you phone or desktop and which OS? Android seems to lose connections more often than iOS for example. :wink:

Hi! Thank you for reply!
I used volumio 1.55 (standart)
earlier i found solution to prevent Connection… screen!
web-interface-masked-frequently-connecting-overlay-t2926-10.html
But after you archive patch - it again!

Can you “Collect in one” and reload archive?

song is playing in the playlist - also work only in mozilla!
The ball is spinning not only on android! In the browser the same way!

This was not my code, but I added it to the github repo. You can download the new zip here

I’ve never had any problems with the playlist play-icon in any browser; tested in IE, Chrome, FF and Safari. But if you can reproduce it, let me know which version of which browser you are using and I’ll see if I can do anything. Please keep in mind that Volumio 1.55 is deprecated, I have no running installation anymore, so it might take a while to test. The above fix (hide the loader) is untested by me :wink:

Hi
Thank you!
But some bug!
If i press stop, and want to play it track again - dont work!