An iTunes Monitor for MoodBlast

Note: This post is over 6 months old. You may want to check later in this blog to see if there is new information.

A better solution: Proxi from Griffin has a built in iTunes monitor with lots of other fun stuff. You can just trigger a basic applescript on track change that sends “^s Rocking out to !itune”, replacing ^s with whatever services it should blast to. If you run “if player state is playing” in a “tell application “iTunes”” block, you can add an else statement that sends “^s !blank” to clear your mood message when iTunes stops. My custom solution below is annoying compared to how well this works.

I whipped up a quick Applescript that you can edit to your tastes and save as an application. It will monitor iTunes for track changes and send a blast with !itune. You can edit parameters to blank your status when the music stops and set what services to update at the top of the script. If you know a little Applescript, you have a lot of possibilities. Change the delays, add some custom string formatting, even set a status based on iTunes state. You could use iTunes to set your available/away status by sending an @keyword in an if/else block. Here’s the rough idea…

TuneBlast.app

  1. -- TuneBlast by Brett Terpstra
  2. -- Monitors iTunes for track changes and sends track
  3. -- info with MoodBlast
  4. --
  5. -- If iTunes isn't loaded it cycles checks every 30 seconds
  6. -- If iTunes is loaded but not playing it cycles every 15 seconds
  7. -- If iTunes is playing it cycles every 5 seconds looking for track changes
  8. --
  9. -- Use the first letter of a service to select it below
  10. -- escept for Tumblr, which is "U"
  11.  
  12. set blastTo to "si" -- Blast to (s)kype and (i)Chat
  13. set blankWhenNotPlaying to true -- Blank selected services when music stops
  14.  
  15. global theTrack, blankedStatus
  16. set {theTrack, blankedStatus} to {null, false}
  17. repeat
  18. tell application "System Events" to get the name of every process
  19. if the result contains "iTunes" then
  20. tell application "iTunes"
  21. if player state = playing then
  22. if current track is not equal to theTrack then
  23. set theTrack to current track
  24. tell application "MoodBlast" to blast "^" & blastTo & " !itune"
  25. if blankedStatus is true then set blankedStatus to false
  26. end if
  27. set theDelay to 5
  28. else
  29. if blankWhenNotPlaying is true and blankedStatus is false then
  30. tell application "MoodBlast" to blast "^" & blastTo & " !blank"
  31. set blankedStatus to true
  32. end if
  33. set theDelay to 15
  34. end if
  35. end tell
  36. else
  37. set theDelay to 30
  38. end if
  39.  
  40. delay theDelay
  41. end repeat

Have some fun, it’s just an example of what doors the new Applescript support in MoodBlast opens up. I didn’t test for too long, but it appears that the CPU hit is pretty minimal if you leave this running. The biggest drawback right now is having to force quit the app. If you know a better way to do this, please share! I’m hoping that a few scripts will pop up to enhance MoodBlast without forcing more feature bloat. Regardless, have fun.

» » » » » »

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>




Safari hates me