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

View file

@ -1139,6 +1139,14 @@ getsong () {
song=${song//'['*} song=${song//'['*}
;; ;;
esac 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 else
song="Unknown" song="Unknown"
fi fi