Created
March 7, 2014 09:29
-
-
Save simong/9408392 to your computer and use it in GitHub Desktop.
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
| -- (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