Monday, November 27, 2006

The Unholy Trinity

One of these things is not like the other...

The unholy trinity I speak of in the title is a combination I stumbled upon tonight with much glee on my part. Apple iTunes COM SDK + JavaScript + Windows Scripting Host. I know, you're probably wondering what the hell kind of medicine I am on, playing with Windows scripting. I had never touched it before tonight either. JavaScript and I have a longterm love/hate relationship as well. I love to swear at it endlessly for its annoyances and lack of ease of debugging, while hating how often it ends up getting the job done for me.

That all said, this combination has just allowed me to do some kick-ass things with iTunes. I had the SDK downloaded for some time, and I wrote some sample C++ apps when I first got it. However, after seeing the Apple JavaScript examples I decided to experiment with them a bit. I'm thoroughly impressed now, similar to Unix shell scripts (although orders of magnitude less powerful), I find that I can just get a task done very quickly, as opposed to writing a full application. Quick and dirty is the key here.

I currently have some scripts to perform some actions I had been meaning to do. Remove any dead tracks from my library, and cleanup bogus comments on some of my tracks. If anyone is interested, I can give them the scripts.

Now, for the challenge. Come up with some task/feature that you would like to do with your iTunes library that you can't quite seem to make happen with playlists. I'll see what I can do about getting it done in a script.

5 comments:

---ryan said...

I'll admit that I did write some code in WSH back in the day. It was for a sysadmin job over the summer. I think I used it to automate some virus scan updates. Remember how much of a pain in the ass that used to be?

Jason said...

You just need to use Vista, where antivirus is no longer necessary ;-)

Yes, I do remember the pain of manual updating. Now that that is pretty much licked, how long before we have people updating their anti-spyware as easily and quickly. That's where the real annoyance lies today.

Anonymous said...

Script request:
- Find duplicate songs in library
- Uncheck all of them, except for the highest bitrate
- leave any checked that are part of a 'greatest hits' or 'anthology' album

Jason said...

That nearly sounds like a created request, just to see if it can be done, but I'm still intrigued enough to give it a shot.

I do have enough multiple instances of songs though that this would be useful.

Now, here's the question, if an AAC exists and an MP3 exists, do I give preference to an AAC at the same and maybe even lower bitrate? Does the AAC always win, because it is less likely to be from a P2P network ;-) I'll play with it a bit and see what I can do, recreational coding :-)

Anonymous said...

Honestly, it's not a created request. I've recently consolidated all my 'libraries' onto one big disk. I have a few failed attempts at ripping all my CD's scattered across different folders, and for whatever reason, some are at lower bitrates than others.

I have enough disk space I decided I wasn't going to physically delete anything, but I do want to remove dupes from the library by unchecking them.

AACs should take priority in my book. It means I either bought them or ripped them with iTunes.