diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 950fcbd94..8a004775c 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -355,6 +355,8 @@ function spotify() { len=${#array[@]}; SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search" SPOTIFY_PLAY_URI=""; + SPOTIFY_CALL_TOKEN=$(python2 -c "import base64; print base64.standard_b64encode('$SPOTIFY_CLIENT_ID:$SPOTIFY_CLIENT_SECRET')") + SPOTIFY_OAUTH_TOKEN=$(curl -s -X "POST" -H "Authorization: Basic $SPOTIFY_CALL_TOKEN" -d grant_type=client_credentials https://accounts.spotify.com/api/token | python2 -c "import sys, json; print json.load(sys.stdin)['access_token']") SPOTIFY_AUTH="Authorization: Bearer $SPOTIFY_OAUTH_TOKEN" searchAndPlay() { diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index af42e5b9f..f912f15e8 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -57,6 +57,11 @@ source $ZSH/oh-my-zsh.sh # User configuration +# Uncomment the following lines if you want to enable spotify search. +# Spotify data can be found creating an app in https://developer.spotify.com/my-applications +# SPOTIFY_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +# SPOTIFY_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment