Created
May 15, 2018 09:32
-
-
Save Leask/37abe8fbf58bad652ec88a1478c1a4ce to your computer and use it in GitHub Desktop.
Get current listening on iTunes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Flora Listening by LeaskH.com | |
initFlora() { | |
export PATH=~/Documents/.flora:$PATH | |
} | |
getLastListening() { | |
echo `cat /tmp/flora_listening 2> /dev/null` | |
} | |
setLastListening() { | |
echo "$*" > /tmp/flora_listening | |
} | |
getCurListening() { | |
echo "`itunes status | sed -n 2p`" | |
} | |
# Main logic | |
initFlora | |
current="`getCurListening`" | |
if [ "$1" = 's' ]; then | |
if [ ! "`getLastListening`" = "$current" ]; then | |
notify $current | |
# itunes lyric | |
fi | |
else | |
notify $current | |
# itunes lyric | |
fi | |
setLastListening $current | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment