Skip to content

Instantly share code, notes, and snippets.

@sneeu
Created July 19, 2012 14:17
Show Gist options
  • Save sneeu/3144246 to your computer and use it in GitHub Desktop.
Save sneeu/3144246 to your computer and use it in GitHub Desktop.
Currently playing in Spotify
tell application "System Events"
-- Checks that an instance of Spotify is running
set isRunning to (count of (every process whose name is "Spotify")) > 0
end tell
if isRunning then
tell application "Spotify"
set theTitle to name of the current track
set theArtist to artist of the current track
set theStarred to starred of the current track
set theState to player state as string
set output to ""
if theState is "playing" then
set output to "▶ "
end if
set output to output & theArtist & " - " & theTitle
if theStarred then
set output to output & " ✭"
else
set output to output & " ✩"
end if
end tell
else
" - Off - "
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment