The album art dealy in iTunes 7 is pretty nice, but after getting ups from ITMS , more than half of my Library stil had no art. Rather than scroll about looking at tunes, I decided it would be nice to have a smart playlist for everything that has art (for looking at in the nifty coverflow view) and one for everything without art (so i can slowly winnow it down) - but there is nothing in Smart playlists conditions that can select on artwork. Ditto for Automator.

There is, however, some artwork related stuff in Applescript. I was able to come up with the following. It assumes you have already created the playlists 'art' and 'noart':

tell application "iTunes"
repeat with a in every track of playlist "Library"
try
set z to artwork 1 of a
add (get location of a) to (playlist "art")
on error
add (get location of a) to (playlist "noart")
end try
end repeat
end tell

I just paste that into Script Editor, no need to save it cause you only want to do it once. I clicked on the 'results' tab near the bottom so you can see it working and it doen't feel hung.

The way it works is if there is no artwork the 'set z to ...' line throws an error and we add to playlist 'noart', otherwise the script makes it to the next line and adds to playlist 'art'.

It has some problems, most specifically that it was dog slow when I ran it on my whole (29gb) library, and significantly faster if I broke up my library into a few playlists and ran it on those one at a time. Much faster.

It also wasn't 100% accurate! Some tracks with artwork made it into the noart playlist, though I haven't noticed any vice versa.

And lastly, the sum of two playlists was like 12-15 tracks higher then the total of 'Library' - and I couldn't figure out the discrepancy.

But anyway, good enough for now, I said.

So then I ended up adding a bunch of artwork to track in the 'noart' playlist, and I wanted some kind of maintainence script to update the playlists. And here it is:

tell application "iTunes"
repeat with a in every track of playlist "noart"
try
set z to artwork 1 of a
add (get location of a) to (playlist "art")
delete (get location of a) from (playlist "noart")
end try
end repeat
end tell

This one runs a lot faster, it does nothing on error, and if the try succeeds we add the track to 'art' and remove from 'noart'.

One thing I noticed is that it would find tracks with art that the original script had missed and correctly file them. I run it again and it finds more. Hmmm.

UPDATE:

Well I feel dumb. The reason it wasn't catching everything is because as it moved tracks out of the noart playlist the index number of the rest of the tracks would shift and they would be skipped. This corrected applescript works well. All it does is count down instead of up:

tell application "iTunes"
repeat with a from (count of every track of playlist "noart") to 1 by -1
try
set b to artwork 1 of (track a of playlist "noart")
add (get location of track a of playlist "noart") to (playlist "art")
delete track (name of track a of playlist "noart") in (playlist "noart")
end try
end repeat
end tell

END UPDATE

This one is maybe worth saving as an iTunes script and running from the menu whenever you feel like it. Especially since we'll assume you are managing new music yourself into one playlist or another and don't need to run the first script but once.

Pretty weak stuff here, but it kind of works and its always nice to spend a frustrating evening grappling with the ass of applescript. It's such a malignant language that when you accomplish anything at all you feel like you've had some major life defining moment and you want to blog it all over the world. VICTORY!!