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 "/debug itunes ain't runnin' bro"
- 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 theGenre to genre of the current track
- set playCount to played count of the current track
- set got_track to true
- end if
- end tell
- set theString to "/m is listening to nothing"
- (*
- if theRating = 10 then set theRating to "½"
- end if
- if theRating = 20 then set theRating to "★"
- end if
- if theRating = 30 then set theRating to "★½"
- end if
- if theRating = 40 then set theRating to "★★"
- end if
- if theRating = 50 then set theRating to "★★½"
- end if
- if theRating = 60 then set theRating to "★★★"
- end if
- if theRating = 70 then set theRating to "★★★½"
- end if
- if theRating = 80 then set theRating to "★★★★"
- end if
- if theRating = 90 then set theRating to "★★★★½"
- end if
- if theRating = 100 then set theRating to "★★★★★"
- end if
- *)
- set rating_string to "("
- set fullstar to "★"
- set emptystar to "☆"
- set halfstar to "½"
- if stars is equal to 0 then
- set rating_string to ""
- else
- 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
- if got_track then
- set theContents to "is listening to [ " & theTrack & " .::. " & theArtist & " .::. " & theAlbum & " .::. " & theTime & " .::. " & theBitrate & "Kbps .::. " & theGenre & " .::. played " & playCount & " times .::. " & rating_string & " ]"
- set theString to "/me " & theContents
- end if -- end of we have track info
- end if -- end of itunes being active
- return theString
- end textualcmd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement