summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2019-02-13 11:37:11 -0800
committerGitHub <noreply@github.com>2019-02-13 11:37:11 -0800
commit7af85aae43cfa4ca280a11a47e160eb539980b15 (patch)
tree679f3faf30354a67cf6ea00f41ef3c4b62a26202
parentca978897a68e506bed62e8e5300ca5d490a3f5e6 (diff)
parente634730e35450b408efa6acc9273d3c1eff12d8c (diff)
downloadzsh-7af85aae43cfa4ca280a11a47e160eb539980b15.tar.gz
zsh-7af85aae43cfa4ca280a11a47e160eb539980b15.tar.bz2
zsh-7af85aae43cfa4ca280a11a47e160eb539980b15.zip
Merge pull request #7567 from genevera/PLUGIN-update-shpotify_7567
Plugin: Updates spotify plugin to current master (as of 2019-01-31)
-rw-r--r--plugins/osx/spotify11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/osx/spotify b/plugins/osx/spotify
index 2ab98d3a0..b4215dbe7 100644
--- a/plugins/osx/spotify
+++ b/plugins/osx/spotify
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
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
# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
@@ -134,8 +134,13 @@ showStatus () {
if [ $# = 0 ]; then
showHelp;
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
- osascript -e 'tell application "Spotify" to activate'
+ osascript -e 'tell application "Spotify" to activate' || exit 1
sleep 2
fi
fi
@@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do
showAPIHelp;
exit 1;
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="";
getAccessToken() {