Merge pull request #138 from iandrewt/osx_songs

OSX: Added Itunes/Spotify support to getsong
This commit is contained in:
Dylan Araps 2016-03-12 18:56:24 +11:00
commit 2b2ef7591e
1 changed files with 8 additions and 0 deletions

View File

@ -1139,6 +1139,14 @@ getsong () {
song=${song//'['*}
;;
esac
elif [ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /iTunes/')" ]; then
song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " name of current track as string')"
state="$(osascript -e 'tell application "iTunes" to player state as string')"
elif [ -n "$(ps aux | awk '!(/awk/) && /spotify/')" ]; then
song="$(osascript -e 'tell application "Spotify" to artist of current track as string & " - " & name of current track as string')"
state="$(osascript -e 'tell application "Spotify" to player state as string')"
else
song="Unknown"
fi