PDA

View Full Version : Applescript help in iTunes




timsit
Dec 22, 2006, 09:51 AM
Help

I have a friend who has asked me to take three large collections of mp3 and merge them. No so bad right? But he wants to keep the best copies, meaning sorting them based on bitrate, rating, etc.

I can dump them into itunes and have it show duplicates then hand sort them, but it seems that Automator or Applescript would be perfect for the job.

I am a novice Applescripter at best so I'm asking can anybody out there get me started with the basic script? I should be able to modify it based on the criteria he gives me.

Thanks for the help.



Eraserhead
Dec 22, 2006, 09:58 AM
if you know no applescript the best is to learn some basics, there may well be something useful on DougsScripts (http://www.dougscripts.com/itunes/)

Nutter
Dec 22, 2006, 11:15 AM
You want something along these lines:


tell application "iTunes"
set markedPlaylist to (make new user playlist with properties {name:"Tracks to delete"})

repeat with someTrack in tracks of library playlist 1
repeat with someOtherTrack in tracks of library playlist 1
if (database ID of someTrack) is not equal to (database ID of someOtherTrack) then
if ((name of someTrack) is equal to (name of someOtherTrack)) and ((artist of someTrack) is equal to (artist of someOtherTrack)) then
if (bit rate of someTrack) is greater than (bit rate of someOtherTrack) then duplicate someOtherTrack to markedPlaylist
end if
end if
end repeat
end repeat
end tell


However, this will be very slow.