Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on textualcmd(cmd)
- set AppleScript's text item delimiters to ""
- set itunes_active to false
- set theString to "/me is listening to silence."
- tell application "Finder"
- if (get name of every process) contains "iTunes" then set itunes_active to true
- end tell
- if itunes_active then
- set got_track to false
- tell application "iTunes"
- 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 theTime to time of the current track
- set theBitrate to bit rate of the current track
- set theKind to kind of the current track
- set theGenre to genre of the current track
- set playCount to played count of the current track
- set stars to rating of the current track
- set theStream to current stream title
- set got_track to true
- end if
- end tell
- set theString to "/me is listening to nothing"
- set rating_string to "("
- set fullstar to "★"
- set emptystar to "☆"
- set halfstar to "½"
- set stars to stars / 20
- if stars is equal to 0 then
- set rating_string to "Not Rated Yet"
- else
- #repeat with i from 0.5 to stars
- # set rating_string to rating_string & halfstar
- #end repeat
- repeat with i from 1 to stars
- set rating_string to rating_string & fullstar
- end repeat
- repeat with i from stars to 4
- set rating_string to rating_string & emptystar
- end repeat
- set rating_string to rating_string & ")"
- end if
- else
- set rating_string to ""
- end if -- end of itunes being active
- if theKind contains "MPEG" then set theKind to "MP3"
- if theKind contains "AAC" then set theKind to "AAC"
- if theKind contains "WAV" then set theKind to "WAV"
- if theKind contains "Apple Lossless" then set theKind to "Apple Lossless"
- if got_track then
- set theContents to "is listening to " & theTrack & " by " & theArtist & " [ " & theAlbum & " .::. " & theTime & " .::. " & theBitrate & "Kbps " & theKind & " .::. played " & playCount & " times.::. " & rating_string & " ]"
- set theString to "/me " & theContents
- end if -- end of we have track info
- return theString
- end textualcmd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement