diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2019-02-15 10:51:57 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2019-02-15 10:51:57 -0700 |
commit | fb141c2257f648cd29b64cbd3f2ca9123f6e427f (patch) | |
tree | a7e56fe7edad0e231aaa4ff0f6f74ce0bad1d368 /plugins/osx | |
parent | 89c9e8a7bc177d4cff6ba8d28cf6b57a9a603095 (diff) | |
parent | 965a27aa69b49f4e447bcaae913e71a010f7d141 (diff) | |
download | zsh-fb141c2257f648cd29b64cbd3f2ca9123f6e427f.tar.gz zsh-fb141c2257f648cd29b64cbd3f2ca9123f6e427f.tar.bz2 zsh-fb141c2257f648cd29b64cbd3f2ca9123f6e427f.zip |
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/osx')
-rw-r--r-- | plugins/osx/spotify | 11 |
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() { |