/* BeejBlog */

Free "Now Playing" for your Blog

Update [29 Oct 2009]: In a freak incident involving fecal projectilation that I’d rather go into, I was betrayed by the Monkey… fear not, my old friend the WinAmp Lllllama welcomed me back with open feet (apparently they have two toed feet, not paws or hooves, who knew?!?)… and wouldn’t you know, the Llama is totally hip to the concept of play history now!  He’s organized about it on a world wide scale!  Go git yerself Orgler’ed!!    Now i just have to figure out how to scrape this data back into my blog… cool Yahoo Pipes actually did the trick!… but man is that service finicky!?!

I really have to say, WinAmp is the shiznet… I shouldn’t have been so fickle and just stuck with the longtime champ on all my digital media capable devices… case in point, on my 800MHz Samsung Q1U UMPC running Windows 7, it only eats 4%! CPU when playing in the background.

** Big Tip **: If it blows up on you at line 15 (the wsh.Run line)… fire a representative curl.exe line from your own CMD.exe window and see what happens… for me it was my McAfee silently holding up the show… visibility is a wonderful thing :)

This solution plugs together a couple easy freebies... you can see the results in the "Recently Played" sidebar on my blog (http://beejblog.com/)

  • Blogger - the blog platform I'm using because Google rocks
  • Twitter - just Google on "Blogger Twitter" to get the "badge" that puts your Twitter feed into your Blogger sidebar
  • Media Monkey - a media player with great functionality including Visual Basic scripting support that provides the execution context for this "mashup"
  • and finally, the vernerable "Curl" which makes quick work of posting the current song up to Twitter... (Note: make sure "curl.exe" is in your global path or edit the following script to point directly to it.)

Edit in your Twitter {email} & {password} in the following script
and drop the script into "c:\Program Files\MediaMonkey\Scripts\Auto" ...
then restart Media Monkey, play a song & refresh your blog page to see
(as long as you don't get any script errors :)

Speaking of script errors, somehow VBScript wasn't happy on my Windows Server 2008 here... merely had to fire "regsvr32 vbscript" from Start > Run to patch that up.

Sub OnStartupCall()
  Script.RegisterEvent(SDB, "OnPlay", "Event_OnPlay")
End Sub

Sub Event_OnPlay()
  Dim cur : cur = SDB.Player.CurrentSong
  Dim description : description = cur.ArtistName & " - " & cur.Title
  If cur.AlbumName <> "" Then description = description & ", Album: " & cur.AlbumName
  If cur.Year <> 0 Then description = description & " [" & cur.Year & "]"
  Dim commandline : commandline = "curl -u {email}:{password} -d status=""" & description & """ http://twitter.com/statuses/update.xml"
  Dim wsh : wsh = CreateObject("WScript.Shell")
  Call wsh.Run(commandline, 0, False) '0 = hide dos window, false = don't wait for return
  Set wsh = Nothing
  Set cur = Nothing
End Sub