Skip to content
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

toggle shuffle via API #330

Closed
aebgit opened this issue Apr 3, 2021 · 4 comments
Closed

toggle shuffle via API #330

aebgit opened this issue Apr 3, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@aebgit
Copy link

aebgit commented Apr 3, 2021

First of all, thanks for the great project! It is community-projects like yours that make tech way more useful!

Is your feature request related to a problem? Please describe.
Triggering of playlists-playback via API should have an option to toggle shuffle-mode.
I trigger playback of certain playlists via the librespot-java API from Homebridge via homebridge-http-switch plugin.
It is a bit annoying over time, when my playlists always start with the 1st song in the list.

Example:

{
     "url": "http://localhost:24879/player/load",
     "method": "POST",
     "body": "uri=spotify:playlist:6w7Lsb0JCGEq8f2pBgoZtr&play=true",
     "headers": {
          "Content-Type": "application/json"
     }
}

Describe the solution you'd like
It would be great to have an option to start playback via API in shuffle-mode. Maybe you could consider something like the example below, which adds a shuffle-parameter to the API request, that could be either true or false.:

{
     "url": "http://localhost:24879/player/load",
     "method": "POST",
     "body": "uri=spotify:playlist:6w7Lsb0JCGEq8f2pBgoZtr&play=true&shuffle=true",
     "headers": {
          "Content-Type": "application/json"
     }
}

Describe alternatives you've considered
I've already tried to play with shuffle=true|false and shuffle_state=true|false, inspired by the Official Spotify API.

Additional context
I usually trigger these playlists when I come home or to wake up in the morning through Homebridge via Apple HomeKit, so I'm not using the Spotify client for that. Later I open Spotify on my phone or computer and change the playlists during the day.
The tool-chain for playback looks as follows:

Apple HomeKit - Homebridge - homebridge-http-switch - SPOCON - LIBRESPOT - forked-daapd/OWNTONE - AirPlay - HomePods

For the sake of completeness, the tool-chain for volume-control looks as follows:

Apple HomeKit - Homebridge - homebridge-http-rgb-push - forked-daapd-homebridge-middleware - forked-daapd/OWNTONE - AirPlay - HomePods

Everything is running super smooth on a RaspberryPi 3.

Thanks in advance for giving me some directions or considering the feature!
Andreas

@aebgit aebgit added the enhancement New feature or request label Apr 3, 2021
@devgianlu
Copy link
Member

I have added a shuffle parameter to the /player/load endpoint (100d248) and also supplied two more endpoints to toggle shuffling and repeating separately (7747677).

P.S. I love how people are integrating librespot-java in their home setups!

@aebgit
Copy link
Author

aebgit commented Apr 3, 2021

Thank you for the superfast response, thats awesome!
Here my results with the new build.
The new endpoint works as expected:
curl -X POST -d "val=true" http://localhost:24879/player/shuffle
curl -X POST -d "val=false" http://localhost:24879/player/shuffle

But the shuffle-toggle included in player/loadis not working.
curl -X POST -d "uri=spotify:playlist:6w7Lsb0JCGEq8f2pBgoZtr&play=true&shuffle=true" http://localhost:24879/player/load
When I watch my Spotify-client (MacOS) in parallel, the shuffle-icon is green for a split-second but is then disabled again before the music starts.

@devgianlu
Copy link
Member

Should be good now.

@aebgit
Copy link
Author

aebgit commented Apr 4, 2021

Awesome :-)
Thank you and have a great easter-time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants