mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
Generation of SPOTIFY_OAUTH_TOKEN from CLIENT_ID and CLIENT_SECRET
This commit is contained in:
parent
bc9c6b5099
commit
ac3e66cfdd
2 changed files with 7 additions and 0 deletions
|
|
@ -355,6 +355,8 @@ function spotify() {
|
||||||
len=${#array[@]};
|
len=${#array[@]};
|
||||||
SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search"
|
SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search"
|
||||||
SPOTIFY_PLAY_URI="";
|
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"
|
SPOTIFY_AUTH="Authorization: Bearer $SPOTIFY_OAUTH_TOKEN"
|
||||||
|
|
||||||
searchAndPlay() {
|
searchAndPlay() {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,11 @@ source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# User configuration
|
# 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"
|
# export MANPATH="/usr/local/man:$MANPATH"
|
||||||
|
|
||||||
# You may need to manually set your language environment
|
# You may need to manually set your language environment
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue