Skip to content

Instantly share code, notes, and snippets.

@simong
Created March 7, 2014 09:29
Show Gist options
  • Select an option

  • Save simong/9408392 to your computer and use it in GitHub Desktop.

Select an option

Save simong/9408392 to your computer and use it in GitHub Desktop.
-- (C) 2011 agreeabledragon <recognize@me.com>
on linkinuscmd(cmd)
set AppleScript's text item delimiters to ""
set spotify_active to false
set theString to "/me is not currently running Spotify."
tell application "Finder"
if (get name of every process) contains "Spotify" then set spotify_active to true
end tell
if spotify_active then
set got_track to false
tell application "Spotify"
if player state is playing then
set theTrack to name of the current track
set theArtist to artist of the current track
set theAlbum to album of the current track
set theUrl to spotify url of the current track
set isStarred to starred of the current track
set got_track to true
end if
end tell
set theString to "/me is not playing anything in Spotify."
if got_track then
set fav to ""
if isStarred then
set fav to "one of my favorite tracks, "
end if
set theString to "/me is listening to " & fav & "\"" & theTrack & "\"" & " by " & theArtist & ", from the album " & theAlbum & " via Spotify. (" & theUrl & ")"
end if
end if
return theString
end linkinuscmd
linkinuscmd("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment