dronir / SpotifyControl

Control Spotify from the command line on macOS
450 stars 56 forks source link

Cannot search for track, artist, or album #33

Open ghost opened 6 years ago

ghost commented 6 years ago

When I try to use these commands: spotify play track [song name] spotify play artist [artist name] spotify play album [album name]

It will just return

Searching albums for [album I entered]
No results found for [album I entered]

And similarly for track and artist searches.

I am using macOS High Sierra Version 10.13.2 What could the cause for this issue?

sharma0611 commented 6 years ago

Spotify has upgraded their search api to require authorization. You need to create a client-id & client-secret; toss it to their accounts API; it returns a token. You need to use this limited time token to then authorize your search (client credentials auth process). To work around it, you can make a local hack that uses python and https://github.com/plamere/spotipy to perform the authorization, get the token, & then feed it to spotifycontrol (thats what I've done for the time being at least).

zachgibson commented 6 years ago

@sharma0611 Do you have a repo for this?

sharma0611 commented 6 years ago

Yes. https://github.com/sharma0611/SpokenWord/tree/master/scripts has an updated spotify_ctrl script that uses a token created by another script in the same directory, spotify_auth.py. To run both, you need to add your credentials to a config.cfg file in the main repo. It's ugly but you can adapt it to your needs.

zachgibson commented 6 years ago

Nice, I’ll have to play around with that. Thanks for sharing. 🙌