Created
November 28, 2012 16:23
-
-
Save ApoorvKhatreja/4162328 to your computer and use it in GitHub Desktop.
Now Playing script for Textual that works for both online radio streams and music library.
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
on textualcmd() | |
set nowPlaying to "I'm not currently playing anything." | |
# iTunes | |
if isRunning("iTunes") then | |
tell application "iTunes" | |
if player state is playing then | |
if current stream title is not missing value then | |
set nowPlaying to "/me is currently listening to '" & current stream title & "' on " & name of current track & "." | |
else | |
set nowPlaying to "/me is currently listening to '" & name of current track & "' by " & artist of current track & " from '" & album of current track & "'." | |
end if | |
end if | |
end tell | |
end if | |
return nowPlaying | |
end textualcmd | |
on isRunning(mediaPlayer) | |
tell application "System Events" | |
tell application "System Events" to return exists (processes where name is mediaPlayer) | |
end tell | |
end isRunning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Application Support folder path doesn't work any more. As per the wiki, the correct path is...
Also, the /me is verbally outputted to the channel now, instead of being sent as an action. So I changed it to just "Listening to...".