Created
July 19, 2012 14:17
-
-
Save sneeu/3144246 to your computer and use it in GitHub Desktop.
Currently playing in Spotify
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
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