Cleaned up the code a bit

This commit is contained in:
Ian Walker 2015-06-15 22:21:00 +09:00
commit 6570870828

View file

@ -161,10 +161,10 @@ function itunes() {
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
status)
its_status=`osascript -e 'tell application "iTunes" to player state as string'`
echo "iTunes is currently $its_status"
if [ "$its_status" = "playing" ]; then
status|nowplaying)
local state=`osascript -e 'tell application "iTunes" to player state as string'`
echo "iTunes is currently $state"
if [ "$state" = "playing" ]; then
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
track=`osascript -e 'tell application "iTunes" to name of current track as string'`
echo "Current track: $artist / $track";