Archive for July, 2008

Jul 27 2008

more appscript

Published by Whizziwig under appscript

Almost identical to add_files, but for adding to your iPod (those of you with iPhones might need to tell me what the source “kind” is — I assume it’s k.iPhone.

usage: copy_to_ipod.py /path/to/music1 /path/to/music2 …

No responses yet

Jul 07 2008

I should be sleeping

Published by Whizziwig under Uncategorized

This one is for dolapo — recursively add all the files in multiple paths specified as command line arguments to iTunes. Braindead, doesn’t check for filetype.

No responses yet

Jul 07 2008

Not-So-Super Remove Dead Tracks

Published by Whizziwig under Uncategorized

iTunes and I do not get along. I like to organize my own music and tag it using hacked perl scripts. iTunes does not notice when I delete files out from under it. So I needed a way to fix that.

There’s Super Remove Dead Tracks, but that’s written in AppleScript, and I loathe applescript, I can’t even look at it for long enough to learn it.

But then I found appscript which exposes most AppleScript as python classes, which is awesome. It’s also stupid easy to install, in leopard, all you need to do is

sudo easy_install appscript

Which is awesome, and then you can access all the AppleScript hooks in everything and it’s far more pleasant. I wrote a script to remove missing/deleted tracks from your iTunes library. It seems that the mere act of processing my iTunes library in python caused iTunes to notice the files were missing and add the (!), but still not remove them. So this basically does the exact same thing as Super Remove Dead Tracks, but is 5-10x more pleasant.

I can’t quite figure out when something is a method and when something is a class, and loading my iTunes library takes way too long (I don’t blame it for the time it takes to put the entire thing into python objects, though lazy-loading would be nice), but it’s still neat.

If you’re going to play with appscript, you should definitely play with ASDictionary which writes out nice files describing the applescript dictionaries for arbitrary programs. The command line tool kept exiting with “Error: ASDictionary has quit or relaunched since asdict was started. Please re-run asdict to continue.” but the GUI works great.

More iTunes scripting to come. Thanks to bbum for a decent intro to appscript.

No responses yet