Bending iTunes to my will with RubyOSA: take 1
A couple months ago I expressed my frustration about iTunes not letting me move podcast files into my library. Several people commented with suggestions, such as converting the ID3 tag to an older version, re-importing the track, and then converting the ID3 tag back to 2.4. This is definitely better than the solution I had found, but still a pain.
I tried to find a scriptable solution, but iTunes doesn’t expose, though AppleScript, the ability to change the ID3 tag version or the mystical ID3 tag attribute that tells iTunes that it’s a podcast.
So, I’ve turned to Ruby. Though a little introspection and experimentation with ID3lib-ruby, I’ve figured out that it is the
CTO (Content Type) ID3v2 tag set to “Podcast” that iTunes is using to put the files in the Podcasts folder. Clearing the
CTO tag and readding the track in iTunes will move it into the Library.
So, with RubyOSA, I’ve written a little script that will loop through the selected tracks in iTunes and clear the
CTO ID3 tag.
There are a few remaining problems that I would like to tackle:
- I can’t figure out how to delete and add the track through RubyOSA. There is a delete method on the track, but doesn’t appear to do anything.
- I want the script to display a dialog confirming the actions about to take place.
- I want to be able to execute the script from the Scripts menu in iTunes, which appears to involve installing OSA Components.
Overall, this has been a fun experiment (and a reason to play with RubyOSA). I’m looking forward to Leopard when this is all built in!