hnarayanan/shpotify

spotify play artist not working

ersel opened this issue · 18 comments

ersel commented

Searching for artists doesn't seem to be working.

When I do
$ ./spotify.sh play artist metallica

It outputs:
Connecting to Spotify's API
Searching artists for: metallica
play uri: spotify:artist:2ye2Wgw4gimLv2eAKyk1NB
Playing (metallica Search) -> Spotify URI: spotify:artist:2ye2Wgw4gimLv2eAKyk1NB

but Spotify doesn't play. Searching and playing albums, tracks and playlists does work.

Having the same issue on my end. I see the indication the artist was found after the search, Spotify opens but does not play the artist.

I can reproduce this now. I don't know why I couldn't a few days ago.

I have a sinking feeling that this has something to do with a recent change in Spotify. I am continuing to debug this.

ersel commented

That's what I thought as well, if one tries play artist command by directly going to the AppleScript Editor it will also fail.

I tried this too. It only works when I paste the uri into the Spotify desktop app in the search field.

I am thinking of temporarily removing this feature until this regression(?) in Spotify is fixed.

ersel commented

How can we file a bug report with Spotify?

I am not sure. But let’s report back here if we find it.

Was this issue resolved from before at some point?
#76

Not fully. The issue that you’re linking to was a more fundamental problem.

If you find the feature working now, it probably means that they have fixed their API.

It was an issue with how the credentials are generated for me. Modify the generation of $SHPOTIFY_CREDENTIALS to also drop \r and it works:

SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n" | tr -d '\r');
curl -X "POST" -H "Authorization: Basic ${SHPOTIFY_CREDENTIALS}" -d "grant_type=client_credentials" https://accounts.spotify.com/api/token 
...
* Connection #0 to host accounts.spotify.com left intact
{"access_token":"[REDACTED]","token_type":"Bearer","expires_in":3600,"scope":""}

Currently it is:

SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n")

#105 made it work for me on macos 10.13.6

Please note that I get these messages.

@hnarayanan is there anything I can do to expedite the pr fixing auth for macos users?

Thank you for reminding me, I will get to this today. :)

Thank you!

@hnarayanan considering this fixes a long standing issue, do you want to tag a new release so we can update the brew recipe?

Been a while since a release - 2.0.2...master