-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing Sonos Favorites #50
Comments
Hi, the library doesn't support Sonos Favourites at the moment. I'll take a look at adding this when I get some time |
I've done a bit of work on this (on the favourites branch), but as these lists can contain tracks, streams, and collections of tracks. It's not simple to handle them, eg: $controller = $sonos->getControllerByRoom("The Hall");
$queue = $controller->getQueue();
$favourites = new Favourites($controller);
foreach ($favourites->getTracks() as $track) {
if (isset($track->title)) {
echo $track->title . "\n";
} else {
echo $track->getName() . "\n";
}
if ($track instanceof Stream) {
echo "\tIgnoring Stream\n";
continue;
}
if ($track instanceof \Countable) {
if (count($track) < 1) {
echo "\tIgnoring empty countable\n";
continue;
}
}
$queue->addTrack($track);
} I'll continue to think about it, but it might require changing some existing classes and therefore need to be part of 2.0 |
This looks promising, thanks. From the Controller-App on mobile devices, I would assume the Should fetching the favorites work like this?
I'll give it a try and see if I can start working with the new Favourites() object. Thanks for the quick reaction. |
Yeh a countable would be a playlist, it could be a Spotify playlist, or a Sonos playlist, or anything else though. |
Hi, |
I have done this from my code with the following methods and a SonosFavorite class. Maybe this can help...
|
Hello,
I'm experimenting by building a simple and child-proof controller for the sonos box. Based on a RPi with the Touchscreen and as I'm developing this in PHP, your sonos library seems to be the awesome tool to talk to Sonos.
I'd like to list the Sonos Favorites in a cover-flow style and start playing the selected Spotify/Radio/Whatever if tapped on.
I can fetch the Playlists from the Network which works great including the Album-Art.
Is there a way to fetch the Sonos Favorites, as only these are able to include Radio Stations (that is, internet radio, Spotify Radio, Amazon Prime Radio, ...).
Thanks
The text was updated successfully, but these errors were encountered: