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:
- 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
- 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…
- 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.