Skip to content

Instantly share code, notes, and snippets.

@ApoorvKhatreja
Created November 28, 2012 16:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ApoorvKhatreja/4162328 to your computer and use it in GitHub Desktop.
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.
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
@ApoorvKhatreja
Copy link
Author

Put this file in ~/Library/Application\ Support/Textual\ IRC/Scripts/np.scpt

@pratul
Copy link

pratul commented Aug 5, 2013

The Application Support folder path doesn't work any more. As per the wiki, the correct path is...

~/Library/Application Scripts/com.codeux.irc.textual/

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...".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment