Archive for the ‘Managing Tracks’ Category
A funny thing started happening shortly after the introduction of iTunes 11 a few months ago. I began getting reports from Correspondents about usually reliable scripts that weren’t working correctly. After closer scrutiny, we were able to determine that some of their media files were appearing twice in the library. That is, they were finding pairs of identical tracks in the “Music” library that each pointed to the same file. Like this:
Two “Music” track entries, same file.
This is not ever supposed to happen. iTunes should not allow a file in a unique location to be added to its library more than once.
Now, this is not the same effect as copying a library track two or more times to a playlist, whereby only one library track is involved. Nor is it the same as when iTunes appends a number to a filename to distinguish it from an earlier-added same-named file. Nor do these tracks seem to be a flavor of iTunes Match duplicates (iTunes Match may or may not be a factor in their appearance). This issue manifests as sets of two distinct library track entries, each having different IDs and both having the same value for the Location property.
I don’t know how this happens. But it definitely has something to do with moving media files around the wrong way and doing so with iTunes 11. It may be a bug and it may even be fixed by now. But I don’t know. I only got it to happen once myself while I was experimenting convolutedly with a different issue and I haven’t been able to replicate it since.
Regardless of how these pairs came to be, how now to find them and then to deal with them? If you have a very large library, you may not even notice if you have any faux pairs.
My duplicate removal apps, Dupin and Dupin Lite, can detect this condition but won’t attempt to delete any files. If the file of one of the tracks were deleted, well, then neither track would be pointing to a file any longer and you’d have a lot of dead tracks. There’s a trick to using Dupin to delete an arbitrary one of each of the track pairs, but, technically, they’re not the sort of “dupes” that Dupin wants to handle.
So, the applet Scan For Double Entries simply looks through your library for track entries that have the same file path (that is, the same file location) and will copy these pairs of tracks to a discrete playlist so you can sort them out yourself. Presumably you’ll want to delete one of the tracks in each faux pair and I’m not sure that’s something you want an automated tool to do for you, you know, automatically.
More information and download is here.
Track Down Purchases v2.3 will examine each track in the entire iTunes library—or a selection of tracks—for items purchased from the iTunes Store (audio, video, and audiobooks) and then sort them by either the purchaser’s name or account ID into discrete playlists, eg: “Purchased by Tom Ryan” or “Purchased by email@example.com”.
Purchaser information is gleaned by examining the track’s local file (purchase info for iTunes Match tracks in the cloud is inaccessible and cloud tracks will be ignored), which, depending on file location and access speed, may take as long a second per track. Just sayin’.
This lateset version fixes a problem for some OS X 10.9 users whereby the script would hang once engaged.
More information and download is here.
Copy Tracks to Multiple Playlists v2.2 will copy the selected iTunes tracks to one or more chosen playlists.
This latest version makes some tweaks for compatibility with OS X 10.9.
More info and download here.
A Correspondent writes that he sorts his Music library playlist by Date Added and meticulously adds each new album’s worth of files to iTunes in reverse order—one file at a time—so that an album will appear in order (well, the order established for them in the Finder); older tracks appear sorted lower in the Music library playlist than newer tracks. Get me?
Predictably, Our Correspondent is dismayed by the drudgery of this method and inquires if AppleScript can provide any relief. AppleScript provide relief from drudgery? Ahoy!
tell application “Finder”
set selectedFiles to selection
repeat with i from (length of selectedFiles) to 1 by -1
my addFile(item i of selectedFiles)
tell application “iTunes”
add aFile as alias
Save this as a Script Bundle—named whatever you like—to your ~/Library/Scripts/ folder. This will make the script available in the system-wide Scripts menu at the right side of the menu bar. Select the files in the Finder you want to add, which have been sorted in the order you want, and launch the script. It will add the files to iTunes in reverse order so that when they are sorted by Date Added in iTunes they appear in the order you had for them in the Finder.
UPDATE November 11, 2013: Added 1 second delay in repeat loop to prevent tracks from having the same date added (to the second) and sorting arbitrarily.
Track Down Purchases v2.2 will examine each track in the entire iTunes library—or a selection of tracks—for items purchased from the iTunes Store (audio, video, and books) and then sort them by either the purchaser’s name or account ID into discrete playlists, eg: “Purchased by Tom Ryan” or “Purchased by firstname.lastname@example.org”.
This latest version changes the name of each playlist created (prefixing it with “Purchased by”) so that they’ll sort together and also fixes an issue with misreading account ID data that produced garbled text in the playlist names.
More info and download here.
I’ve been using a variation of this search script for a while so I thought I’d update it with some customization settings nailed on and post it (there’s a simple snippet version of it here). The thing is: I often want my iTunes search results to go directly to a playlist so I can get right to work on them there, usually tag editing. Without some automation this is typically a multi-stage grind comprised of searching, selecting track results, making new playlist, naming new playlist, locating and selecting the tracks again when new playlist gets focus (stab!), putting tracks into playlist by any one of various means, and then forgetting why I was searching for these tracks in the first place. (Related memory-loss issue: Name New Playlist From Selection.)
Search Results to Playlist puts a floating window over iTunes that provides the ability to search iTunes and copy the track results to a designated Results Playlist.
It can search the entire library, the selected playlist, or any of the categories (Music, Movies, Books, etc) for text in All, Name, Artist, Album, or Composer tags and then copy the results to a playlist. The script will create this Results Playlist if necessary. If the playlist already exists then the track results can replace its current contents or may be appended to it.
Dual-Pass Search conducts a two-pass search for tracks in the currently selected playlist. On the first pass, the search query behaves like iTunes’ own searchbox. Then the track results from the first pass are processed with a second search query.
The track results can be displayed in a Results Window and optionally sent to Results Playlist in iTunes.
If you have been making purchases from the iTunes Store using several names or account names then maybe you’ll have noticed that there’s no easy way to sort purchased tracks by the name or account name used to make the purchase. Oh, wait a minute. Yes there is.
Track Down Purchases v2.0 will examine each track in your entire iTunes library—or a selection of tracks—for items purchased from the iTunes Store (audio, video, and books) and then sort them by either the purchaser’s name (the “Purchased by” entry in a track’s Get Info Summary tab) or account (”Account Name”) into discrete playlists.
This latest version is written as a Cocoa-AppleScript applet for OS 10.6 or 10.7 only, adds the ability to sort by account name, and provides a progress indicator. (My thanks to Correspondent Andrew Wynn Rouse for inventing the account name search portion.)
Remove n Characters From Front or Back v4.0 helps you delete a specified number of characters from either the beginning or the ending of the Song Name, Album, Artist, Comments, Composer or Show tag (or their “Sort” siblings) of each selected track. For example, delete the initial digits and the space from “01 First Track”, “02 Second Track”, and so on.
This latest version is written as a Cocoa-AppleScript Applet and can only run in OS X 10.6 or 10.7. As you can see from the pic above, it consolidates all settings into a single window and provides an example that is updated as the settings are changed. Text between the arrows would be removed.
Correspondent Wayne B. recently wondered if there is a way to get a reference to a track in iTunes based on its file path. Well, unfortunately, you can’t do something like this:
tell application "iTunes" set trackRef to (get some file track of library playlist 1 whose location is "some/file/path.ext") end tell
That will generate an error. But you can trick iTunes into giving you the track reference by using the add command–if you are certain the file is already in iTunes’ database. When you add the file iTunes will check its database for the the corresponding library track for you and if it exists will give up the reference–and it won’t re-add it:
set theFile to choose file -- or however you get the file path tell application "iTunes" try set trackRef to (add theFile as alias) tell trackRef log (get name) # and so on... end tell end try end tell
But remember that if the file isn’t already in iTunes’ database then iTunes will add the file as a matter of course, which may not be what you want. So this trick may work best only when you know a file is currently in your library.
You will not want to use the open command instead of add, because open will compel iTunes to play the file in addition to any add-housekeeping.