Skip to content

Instantly share code, notes, and snippets.

@Parsoa
Forked from JorenSix/now_playing.osascript
Last active December 19, 2016 19:35
Show Gist options
  • Save Parsoa/af5f635c45272a3b307ee27add2e99be to your computer and use it in GitHub Desktop.
Save Parsoa/af5f635c45272a3b307ee27add2e99be to your computer and use it in GitHub Desktop.
This script displays lyrics for the current track playing on Spotify
out=`osascript ~/.applescript/spotify_meta.osascript`
echo $out
patter="\(.*\)"
track=`echo $out | sed 's/\(.*\)|\(.*\)|\(.*\)|\(.*\)/\1/'`
album=`echo $out | sed 's/\(.*\)|\(.*\)|\(.*\)|\(.*\)/\3/'`
artist=`echo $out | sed 's/\(.*\)|\(.*\)|\(.*\)|\(.*\)/\2/'`
echo $track
echo $album
echo $artist
#curl -s "http://makeitpersonal.co/lyrics?artist=$artist&title=track"
glyrc lyrics -a $artist -t $track -v 0 -w stdout
#!/usr/bin/osascript
#
# now_playing.osascript
#
# Osascript to fetch the meta data of the currently playing
# track in Spotify. This works only on Mac OS X.
tell application "System Events"
set myList to (name of every process)
end tell
if myList contains "Spotify" then
tell application "Spotify"
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 & "|" & "Playing"
else if player state is paused then
set output to trackname & "|" & artistname & "|" & albumname & "|" & "Paused"
end if
end if
end tell
else
set output to "Spotify not running"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment