Search:

<< >>
  12345
6789101112
13141516171819
20212223242526
27282930   

view by post / day / month

posts
they'rrrrrre back! 4/30/2008
another flick 4/29/2008
keep your eyes ahead 4/27/2008
another day, another time 4/25/2008
one a month 4/24/2008

previous next
 
 
they'rrrrrre back! 10:30am 4/30/2008  

In news that is sure to excite only me, after some fiddling around with Objective C, Xcode, and Applescript, i've concocted a Mac iTunes monitoring application that does the same thing my Windows-based "iTunesLog" does ... keeps track of what i've listened to, and sends tracks and artwork to my fac13 mySQL database for cataloging and display. So in other words, my listening statistics are back.

Among the nagging issues i had to solve in order to make this happen:

  • Figuring out how to intercept the notifications that are broadcast by iTunes whenever the player is paused or started, or the track changes. Credit for solving this problem must be attributed to this blog.
  • Learning how to send data over the internet to my web server. For text, this isn't so hard ... the Applescript "URL Access Scripting" application can do it just fine, although a bit inconveniently in the form of a "form data" string that is POSTed via http to a URL. Of course, the wrinkle in "just fine" occurs when you throw unicode text encoding into the mix. "Bjork" gets sent no problem, but try "Björk" and you may get grumpy.
  • A subset of the above aim, learning how to send binary image data over the internet without resorting to a clumsy FTP approach. This had me pulling my hair out. I finally found another blog demonstrating how to encode images in base64 and send via XML, in a manner very similar to how iTunesLog worked. The success of this approach convinced me to ditch URL Access Scripting and go with this HTTP/XML method.
  • The final bit of annoyance was discovering that saving images out of iTunes is not exactly a snap. The method i'd found via the incredibly useful Doug's iTunes Applescripts was to grab the image data and dump it into a file. For some reason, you have to strip off the beginning of the file to remove extraneous data and create a valid image file. But for some of the jpg's embedded in my mp3's, this doesn't work. After fighting with them for a day, initially misdiagnosing the problem as a wonky Adobe Photoshop jpeg header, i finally found that i could do a quick search of the first 1k of the file for the "JFIF" descriptor, and truncate the file using that as a reference.

And with that, blammo! We're back in business, baby!

Got my blue on for today's Chelsea showdown with European nemeses Liverpool. Despite my continued nay-saying, we've pulled through the biggest tests of the concluding season ... defeating Arsenal to stay in the championship race then beating leader Manchester United to draw level and make the last few weeks reeeeeallllly interesting. If we keep a clean sheet at home against the Mighty Reds then we're through to the Champions League final in Moscow against United. Fingers crossed.

last edited 3:14pm 5/6/2008 back to top
 
 
previous next