forslund / spotify-skill

Mycroft Skill to control spotify using the Spotify Connect API
Apache License 2.0
71 stars 38 forks source link

Use this Skill to control Raspotify #151

Open nilskretschmer opened 3 years ago

nilskretschmer commented 3 years ago

Hey there,

is it possible under the current circumstances to bypass the API Token problem by controlling raspotify directly? So using Voice commands to send them to raspotify which then skips songs etc.? Raspotify has it's own config which provides an option for username and password and it should be available as a device for the skill then right? Greetings and thank you for your work!

forslund commented 3 years ago

I don't think raspotify has any direct controls (I could be wrong) and requires to use the Spotify Connect api to start playback etc. So to access the device created by raspotify, access to the API is needed. At least as far as I know.

nilskretschmer commented 3 years ago

You seem to be right. Sorry I just read through raspotify and saw that it's just a librespot wrapper and has no API on its own. But I found something interesting - even when it's over 2 years old: Thread

So as far as I understand this is not possible in case of raspotify (and not possible using mycroft), because:

  1. Raspotify acts just as a Spotify Connect Client
  2. The mobile app on your phone is some kind of streaming server
  3. All authenticating is handled by the mobile app - not librespot or raspotify itself
  4. API Access is done by the app

So to get this working again we need to get the authentication working again in your skill so it can access spotify's web API and playback audio by itself right? If I can help you along with modifying the skill to pass in everyone's own token let me know.

forslund commented 3 years ago

Thanks. I think I'm about halfway done creating a replacement auth class that uses creds from a json (basically extending spotipy's own auth class).

Gonna try to get something pushed this weekend that can be used with some manual intervention...and that will probably need testing and comments and stuff. And if you want to hack on a solution yourself feel free. I have quite limited time these days so my expected delivery may not be 100 % correct :/

forslund commented 3 years ago

I've pushed the branch feature/local-api-key which seem to work Ok with a cached spotipy oauth. Next step is to create a small wrapper and a script to setup the cached spotpy-oauth token along with instructions...

joshuajaharwood commented 3 years ago

I've pushed the branch feature/local-api-key which seem to work Ok with a cached spotipy oauth. Next step is to create a small wrapper and a script to setup the cached spotpy-oauth token along with instructions...

If someone could tell me briefly how to manually generate and store an oauth credential for the skill, I'd be more than happy to test it.