Applescript help in iTunes

Discussion in 'Mac Programming' started by timsit, Dec 22, 2006.

  1. macrumors newbie

    Dec 22, 2006

    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.
  2. macrumors G4


    Nov 3, 2005
    if you know no applescript the best is to learn some basics, there may well be something useful on DougsScripts
  3. macrumors 6502

    Mar 31, 2005
    London, England
    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.

Share This Page