Skip to content

Commit

Permalink
increase/decrease volume using current spotify volume
Browse files Browse the repository at this point in the history
  • Loading branch information
pahwaranger committed Oct 27, 2015
1 parent 5853d45 commit e7f3aaa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -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`.
Expand Down
24 changes: 24 additions & 0 deletions SpotifyControl
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e7f3aaa

Please sign in to comment.