Monday, May 14, 2012

Applescript editor not responding

I did the following script in order to identify itunes songs that doesn't have artwork. It's based on other script that I found in net.



tell application "iTunes"
repeat with a in every track of playlist "Library"
if not (exists (artwork 1 of a)) then
add (get location of a) to (playlist "noart")
end if
end repeat
end tell


It seems to be working, it compiles well, and because I can that it in event log windows:



tell application "iTunes"
count every track of playlist "Library"
--> 10684
exists artwork 1 of item 1 of every track of playlist "Library"
--> true
exists artwork 1 of item 2 of every track of playlist "Library"
--> true


But after 4 hundred tracks, it starts to run slowly, and applescript stops responding after one thousand tracks.



I thought that maybe I could be exhausting my mac memory, but in Activity Monitor, I can see that Applescript is consuming 100% CPU and less than 50MB of memory. I'm running macos 10.7.4 on a macbook pro (i7 with 4GB ram).



As you can see my itunes library has 10684 tracks. It's not a small library, but it's not a huge one.



Does anyone has any advice? Or a script to identify tracks without artwork?



TIA,



Bob





No comments:

Post a Comment