Here's the complete text for the download you were just reading about. For those that hate to read documentation, here's a link to DOWNLOAD Corral iTunes Dupes 1.01.

To return to the Downloads page, click the Downloads button at left.

Corral iTunes Dupes 1.01

Corral iTunes Dupes 1.01 is a modification of Doug Adams' Corral iTunes Dupes v1.0. When activated, the script checks iTunes for duplicate tracks, based on user-selected criteria; duplicates are then "corralled" into a playlist.

This version makes three modifications:

  1. The path to the iTunes Music Library.xml file is now automatically obtained.
  2. The perl code at the heart of the script has been tweaked to make Total Time values less precise.
  3. The "corralling" dialog now reports the number of dupes, and uses the user-configured destination playlist name.


Configuring & Installing Corral Dupes

There are two optional settings available in Corral iTunes Dupes: access the settings by opening the script in the Script Editor application located at /Applications/AppleScript/Script Editor; make changes as directed below; Save the script.

dupe_playlist_name property : sets the name for the playlist that will hold duplicate tracks. The default name is "Dupes"—if this conflicts with your playlist schema, change it here.

initCriteria property : additional criteria can be added to the list, such as: "Comments", "Play Count", "Rating", "Genre". Additional criteria must be enclosed in double-quote marks, separated from other criteria by a comma.
example
original list: {"Name", "Artist", "Album", "Size", "Kind", "Bit Rate"}
adding "Genre": {"Name", "Artist", "Album", "Size", "Kind", "Bit Rate", "Genre"}

To install Corral iTunes Dupes, simply copy the script into your iTunes Scripts folder, located in Library/iTunes/Scripts in your Home folder. If there is no folder named "Scripts" there, create one and put the script inside it. The script can be then be activated by selecting it from the iTunes Script menu.

Since this is an AppleScript "applet," you can also treat it like any application—add it to your Dock, or leave it on your Desktop, or even drop it into your Applications folder.


Using Corral iTunes Dupes

When you activate the script, a dialog prompts tou to select the criteria which you want to use to determine duplicate tracks; you can select multiple criteria by Command-clicking.

Remember that the more criteria you select, the more refined your search will be. On the other hand, just selecting "Artist" and "Bit Rate", for example, will probably just be a waste of your time.

When you click OK, the script locates your current "iTunes Music Library.xml" file, and reads it into a little Perl program which tallies up all the tracks meeting the specified criteria. The script then builds a "Dupes" playlist to which all the duplicated tracks are added. If the Dupes playlist already exists, it is emptied first.

When the playlist is filled, the script beeps. If iTunes is the frontmost application, a dialog pops up to let you know the script is done.

Stopping Operation:
If you'd rather not wait for the Dupes playlist to fill up with the 12,465 tracks that came back after you selected "Genre" as your sole criterion <g>, click on the script's Dock icon (to bring it to the front) and press Command – . (period).

Deleting Tracks/Trashing Files from a Playlist:
You must decide which tracks to delete from the assembled tracks. This script is not capable of making that decision for you.

Select the track or tracks you want to delete in the Dupes playlist and press Option-Delete. iTunes will ask if you want to simply remove the selected tracks from the iTunes library, or also Trash the tracks' files.

Using "Total Time":
The iTunes database keeps very fine track of each music file's play length, right down to the thousandth of a second. But different encoding formats or compression can lead to slight changes in these times; for instance, a track that's 3:40.843 in AIFF might run only 3:40.773 as an mp3. Due to this precision, comparing the Total Time between formats is not workable.

This version of the script adds a line to the perl code, trimming the decimal bits of seconds from Total Time, enabling cross-format hits. (Note however, that if a format shift drops a track from say, 2:26.018 to 2:25.981, there will be no benefit from this "blurring" of Total Time.)

Please post comments, bugs, or requests to the AppleScript for iTunes board over at iLounge.


To-Do
Needs an icon for easier identification in the Dock

Credits
The Total Time mod was inspired by a post from johnpritt to the iLounge AppleScript board in August, 2007. I adpated Doug's GetMusicFolder() function to automatically locate the xml file out of my frustration with hard-coded paths, in light of iTunes' behavior of changing the xml file's name to "iTunes Library.xml" under certain circumstances.

 

DOWNLOAD Corral iTunes Dupes 1.01