Merge pull request #7567 from genevera/PLUGIN-update-shpotify_7567

Plugin: Updates spotify plugin to current master (as of 2019-01-31)
This commit is contained in:
Robby Russell 2019-02-13 11:37:11 -08:00 committed by GitHub
commit 7af85aae43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function spotify() { function spotify() {
# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org> # Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org>
# #
# Contains numerous helpful contributions from Jorge Colindres, Thomas # Contains numerous helpful contributions from Jorge Colindres, Thomas
# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin # Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
@ -134,8 +134,13 @@ showStatus () {
if [ $# = 0 ]; then if [ $# = 0 ]; then
showHelp; showHelp;
else else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed."
exit 1
fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
osascript -e 'tell application "Spotify" to activate' osascript -e 'tell application "Spotify" to activate' || exit 1
sleep 2 sleep 2
fi fi
fi fi
@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do
showAPIHelp; showAPIHelp;
exit 1; exit 1;
fi fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"); SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI=""; SPOTIFY_PLAY_URI="";
getAccessToken() { getAccessToken() {