Archive for March, 2007

Ruby script for iTunes on both Windows and Mac OS X


I see people automating complex tasks on their computers by using scripts. Same here, I love it. When it comes to iTunes, we Mac OS X owners are using AppleScript – and the best place to start looking for all sorts of solutions is Doug’s page. For Windows users their iTunes looks the same, but the AppleScript won’t work. Instead, they can use VBscript or JavaScript to accomplish pretty much similar things. However, I think the Mac people are leading in terms of iTunes scripting solutions that are available for download. And I know that Doug gets lots of requests to provide the same functionality for Windows, too.

Now I had a dream. Wouldn’t it be great to use a scripting language that is available both on Windows and Mac OS X, and create cross-platform iTunes scripts? My pick would be Ruby, as I already know that from Rails development. Mac users need rubygems and rbosa, Windows users just need ruby. Then run this here:

if RUBY_PLATFORM.match('darwin')
  require 'rubygems'
  require 'rbosa'
  itunes ='iTunes')
elsif RUBY_PLATFORM.match('mswin')
  require 'win32ole'
  itunes ='iTunes.Application')
  #any other platform that has iTunes? add here...

Works so far! Do you like that???

Think of ruby scripts that can be used by both Windows and Mac users… Think of script developers on both platforms helping each others… Think of Ruby on Rails applications where you can query and tidy your music collection from any browser window in the world…

Nice. I need to reserve some time to digg more into this topic.


Toggle those iTunes remote speakers


Remote Speakers
I like the AirTunes / remote speakers feature for its easy setup and the perfect sync. Also, it’s quite a bit cheaper then a Sonos system for a few rooms. However, I don’t like that Apple forgot to expose the remote speakers functionality in their iTunes API, at least not in the versions 4.6 up to the current 7.0.2. So the only way to switch on or off a particular room is by using a mouse. That’s not what people want who have a Mac mini next to their TV and like to operate it with the remote only.

Martin of CASE Apps just published version 2.0b2 of his excellent Sofa Control application. This version contains some contribution by me in the CoverFlow and iTunes scripts. You can now all toggle those iTunes remote speakers with the remote. Yippee.

Thanks Martin! And I have seen you included me in the script’s credits … I’m honoured.