9bfcab7d10e216df9fe7110334a41cf2f802bace

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

osx: use return instead of exit in spotify function

Diff

 1diff --git a/plugins/osx/spotify b/plugins/osx/spotify
 2index 6233d813dbdfd2cc54f6bd0f6da28565e84ffed8..663215a7407870b48147b5268903355b78708aa3 100644
 3--- a/plugins/osx/spotify
 4+++ b/plugins/osx/spotify
 5@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
 6 else
 7 	if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
 8 		echo "The Spotify application must be installed."
 9-		exit 1
10+		return 1
11 	fi
12 
13     if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
14-        osascript -e 'tell application "Spotify" to activate' || exit 1
15+        osascript -e 'tell application "Spotify" to activate' || return 1
16         sleep 2
17     fi
18 fi
19@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
20                 if [ -z "${CLIENT_ID}" ]; then
21                     cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
22                     showAPIHelp;
23-                    exit 1;
24+                    return 1
25                 fi
26                 if [ -z "${CLIENT_SECRET}" ]; then
27                     cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
28                     showAPIHelp;
29-                    exit 1;
30+                    return 1
31                 fi
32                 SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
33                 SPOTIFY_PLAY_URI="";
34@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
35                         cecho "Autorization failed, please check ${USER_CONFG_FILE}"
36                         cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
37                         showAPIHelp
38-                        exit 1
39+                        return 1
40                     fi
41                     SPOTIFY_ACCESS_TOKEN=$( \
42                         printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
43@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
44                 echo "  vol down                     # Decreases the volume by 10%.";
45                 echo "  vol [amount]                 # Sets the volume to an amount between 0 and 100.";
46                 echo "  vol                          # Shows the current Spotify volume.";
47-                exit 1;
48+                return 1
49             fi
50 
51             osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
52@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
53         "help" )
54             showHelp;
55             break ;;
56+
57         * )
58             showHelp;
59-            break;
60+            return 1 ;;
61 
62     esac
63 done