DATA=$(osascript -e 'tell application "System Events"
set myList to (name of every process)
end tell
if myList contains "iTunes" then
tell application "iTunes"
if player state is stopped then
set output to "Stopped"
else
set trackname to name of current track
set artistname to artist of current track
set albumname to album of current track
if player state is playing then
set output to trackname & " | " & artistname & " | " & albumname & "new_line" & "Playing on iTunes | "
else if player state is paused then
set output to trackname & " | " & artistname & " | " & albumname & "new_line" & "Paused | "
end if
end if
end tell
else
set output to "iTunes is not running"
end if')
echo $DATA | awk -F new_line '{print $1}'
echo $DATA | awk -F new_line '{print $2}'
26
Simple iTunes Song Meter
Posted in Music by olivierdeen 632 days ago