diff --git a/README.md b/README.md index 406a430..b974bd0 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ seconds to jump ahead. seconds to jump backwards. * To change volume, type `spotify volume N` where N is a number between 0 and 100. +* Increase volume, type `spotify increasevolume N` where N is a number between +0 and 100 that you want to increment by. +* Decrease volume, type `spotify decreasevolume N` where N is a number between +0 and 100 that you want to decrement by. * To toggle shuffle, type `spotify shuffle`. * To toggle repeat, type `spotify repeat`. * To show a list of these commands, just type `spotify`. diff --git a/SpotifyControl b/SpotifyControl index 96e36d9..3ec1e9d 100755 --- a/SpotifyControl +++ b/SpotifyControl @@ -14,6 +14,8 @@ on run argv set msg to msg & " shuffle - Toggle shuffle\n" set msg to msg & " repeat - Toggle repeat\n" set msg to msg & " volume N - Set Volume to N (0...100)\n" + set msg to msg & " increasevolume N - Increment Volume by N (0...100)\n" + set msg to msg & " decreasevolume N - Decrement Volume by N (0...100)\n" return msg end if set command to item 1 of argv @@ -101,6 +103,28 @@ on run argv end tell return "Changed volume to " & newVolume + else if command is equal to "increasevolume" then + set volumeInc to item 2 of argv as real + tell application "Spotify" + set currentVolume to sound volume + set newVolume to currentVolume + volumeInc + if newVolume < 0 then set newVolume to 0 + if newVolume > 100 then set newVolume to 100 + set sound volume to newVolume + end tell + return "Changed volume to " & newVolume + + else if command is equal to "decreasevolume" then + set volumeInc to item 2 of argv as real + tell application "Spotify" + set currentVolume to sound volume + set newVolume to currentVolume - volumeInc + if newVolume < 0 then set newVolume to 0 + if newVolume > 100 then set newVolume to 100 + set sound volume to newVolume + end tell + return "Changed volume to " & newVolume + else if command is equal to "shuffle" then tell application "Spotify" set shuffling to not shuffling