dougscripts.com

November 18 2018 - 8:38 pm

Some More About Re-Ripping

After my last post about re-ripping CDs, it occurred to me that I should do some re-ripping myself. So, as discussed in the post, I was able to confirm that iTunes does warn you about tracks you’ve already ripped (tracks with the same Song Name, Artist and Album) and then offers to “Replace Existing”.

However, it only tells you this after you’ve engaged “Import CD” and advanced past the encoder settings dialog. I would much prefer to be aware of these tracks and any potential anomalies before engaging the rip so I can make any alterations to accommodate more efficient ripping. For instance, what file type, bit and sample rates are these already ripped tracks? How many of them are there? Are there any duplicates?

(Another good question is: Did I change the metadata of any tracks I previously ripped from this CD? Those will be harder to find, especially if the Album and/or Artist tags have been changed; iTunes will not consider those tracks a match for any on the CD. The tag info could have been changed by your own hand, or, if it’s been several years since you’ve inserted the CD, Gracenote could have supplied different tag info. I’ve had this happen.)

Since I know iTunes will offer to “Replace Existing” if it finds library tracks with the same Song Name, Artist and Album I will want to see any of those. And here’s a script that tries to find them and offers to wrangle them into a discrete playlist for further investigation:

tell application "iTunes"

try

set src to first source whose kind is audio CD

set cdPlaylist to first audio CD playlist of src

set cdAlbumTitle to (get src's name)

on error

try

display dialog "No CD appears to be mounted in iTunes." buttons {"Quit"} default button 1 with title "Cannot proceed…" with icon 0 giving up after 15

end try

return ## quit

end try

set foundLibTracks to {}

repeat with i from 1 to (count tracks of cdPlaylist)

set anEntry to track i of cdPlaylist

try

set foundLibTracks to (foundLibTracks & (get every track of library playlist 1 whose name is (anEntry's name) as text and artist is (anEntry's artist) as text and album is (anEntry's album) as text))

end try

end repeat

if (length of foundLibTracks) > 0 then

try

set opt to button returned of (display dialog (((length of foundLibTracks) as text) & " tracks in the iTunes library match the Name, Artist and Album of tracks on CD " & cdAlbumTitle & ".") buttons {"Copy Them to A Discrete Playlist", "OK, Thanks"} default button 2 with title "Tracks Found…" with icon 2)

if opt starts with "copy" then

tell me to makeThePlaylist(cdAlbumTitle, foundLibTracks)

end if

end try

else

try

display dialog ("Couldn't find any tracks from CD " & cdAlbumTitle & " in the iTunes library.") buttons {"OK"} default button 1 giving up after 30

end try

end if

end tell

to makeThePlaylist(cdAlbumTitle, foundLibTracks)

tell application "iTunes"

set newPlaylist to (make new playlist with properties {name:cdAlbumTitle})

repeat with t in foundLibTracks

try

duplicate t to newPlaylist

end try

end repeat

reveal newPlaylist

end tell

end makeThePlaylist

After running this and getting a positive result, I copy the tracks to a playlist (which I can always delete later), open it in its own window in Songs View, and do a side-by-side comparison with the CD tracks.

Some might say this is tad time consuming. But this is probably the last time I’ll ever rip these CDs—as Lossless—and I want to get it right. I even temporarily used this script in the System Preferences > CDs & DVDs > When you insert a music CD > Run script… pref so it would automatically run.

As for finding any tracks previously ripped from this CD for which, for whatever reason, iTunes doesn’t offer to “Replace Existing”, it’s time to break out the eyeballs and eardrums. I keep my Music library as “Songs” displayed in Songs View with the Column Browser open at the top. It is a simple matter to display just the tracks of any Artist and Album selection and run down any tracks I may have already ripped from a CD. Then, as explained in the earlier post, you can “equalize” the tracks to get the “Replace Existing” option.

Finally, here are two tips for using the Column Browser: when a column is selected you can type the first letter or two of the item you want to jump to; and here’s a tip on how to quickly revert back to “all tracks” after displaying discrete tracks based on the Columnn Browser selection.

(PS: Don’t use the “Add to Playlist” command from the CD tracks’ contextual menu. While it will import the tracks, it doesn’t offer to change encoders and it doesn’t offer to replace any existing library copies. I don’t know what to use it for, actually,)

Site contents © 2001 - 2018 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not interrupt the one doing it.