Created
January 5, 2011 12:01
-
-
Save chapel/766236 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
on linkinuscmd(cmd) set AppleScript's text item delimiters to "" tell application "System Events" to if (name of processes) does not contain "iTunes" then return "/me is not currently running iTunes." tell application "iTunes" to if player state is playing then set theTrack to "\"" & name of current track & "\"" if theTrack is "\"\"" then set theTrack to "" set theArtist to " by " & artist of current track if theArtist is " by " then set theArtist to "" set theAlbum to " á Album: " & album of current track if theAlbum is " á Album: " then set theAlbum to "" set theBitrate to " á " & bit rate of current track & "kbps" if theBitrate is " á kbps" then set theBitrate to "" set theKind to " " & kind of current track if theKind contains " MPEG " then set theKind to " MP3" if theKind is " " then set theKind to "" set theStream to " streaming \"" & current stream title & "\"" if theStream is " streaming \"" & missing value & "\"" then set theStream to "" set theRating to rating of current track if theRating is not "" and theRating is not missing value then set stars to (theRating div 20) as integer if theRating is greater than 0 and stars is equal to 0 then set stars to 1 end if set ratingStr to " (" set fullstar to "?" set emptystar to "?" set halfStar to "?" if stars is equal to 0 then set ratingStr to "" else repeat with i from 1 to stars set ratingStr to ratingStr & fullstar end repeat repeat with i from stars to 4 set ratingStr to ratingStr & emptystar end repeat set ratingStr to ratingStr & ")" end if else set ratingStr to "" end if return "/me is listening to " & theTrack & theStream & theArtist & theAlbum & theBitrate & theKind & ratingStr else return "/me is not playing anything in iTunes." end if end linkinuscmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment