7af85aae43cfa4ca280a11a47e160eb539980b15

Author
Robby Russell <robby@planetargon.com>
Committer
GitHub <noreply@github.com>
Date

Message

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

Plugin: Updates spotify plugin to current master (as of 2019-01-31)

Diff

 1diff --git a/plugins/osx/spotify b/plugins/osx/spotify
 2index 2ab98d3a0e0b382a21af213acddaefb38ec18afc..b4215dbe71738a89f1efb77ca2821ef6e5dff342 100644
 3--- a/plugins/osx/spotify
 4+++ b/plugins/osx/spotify
 5@@ -1,7 +1,7 @@
 6 #!/usr/bin/env bash
 7 
 8 function spotify() {
 9-# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org>
10+# Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org>
11 #
12 # Contains numerous helpful contributions from Jorge Colindres, Thomas
13 # Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
14@@ -134,8 +134,13 @@ showStatus () {
15 if [ $# = 0 ]; then
16     showHelp;
17 else
18+	if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
19+		echo "The Spotify application must be installed."
20+		exit 1
21+	fi
22+
23     if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
24-        osascript -e 'tell application "Spotify" to activate'
25+        osascript -e 'tell application "Spotify" to activate' || exit 1
26         sleep 2
27     fi
28 fi
29@@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do
30                     showAPIHelp;
31                     exit 1;
32                 fi
33-                SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n");
34+                SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
35                 SPOTIFY_PLAY_URI="";
36 
37                 getAccessToken() {