How to bulk rename itunes files from external data source.
November 12, 2009 3:10 PM   Subscribe

How can I bulk rename files in itunes according to data contained in a separate file?

I have 4000-some .wav files in itunes that are essentially field recordings of people talking. The files are named with a 10 digit unique id number and the date acquired. Example: 1234567890_11122009. In a separate csv file I have the identifying information of the individual with the same unique ID number.

I have rated all 4000 recordings based on quality and want to maintain those ratings, but would like to rename the files to drop the unique ID and instead insert the person's name from the csv file. I.e. 1234567890_11122009 becomes Smith_Mary_123_Fake_Street_Anytown_STATE

Can anyone picture a workflow that would accomplish this mass filename change while still maintaining the ratings?

I use a mac and have a decent understanding of automator, grep, csv files etc, but have no real programming skill. I am willing to convert recordings to a different format (mp3 etc.) if that would help. Any ideas?
posted by jlowen to Computers & Internet (5 answers total) 2 users marked this as a favorite
 
I'd do something like this in Perl.

-Mass encode everything to AAC within iTunes. (Select all right click encode to AAC)
-Use the Perl module Mac-iTunes-Library to read each distinct title. (you'll have 2 per, one AAC one WAV)

For each title

- Read the rating value for the WAV file
- Use DBD-CSV to pull a record from the CSV by the title
- Use Mac-Itunes-Library to set the desired info from the CSV into the AAC version as well as the earlier read rating.
posted by wongcorgi at 6:06 PM on November 12, 2009


The tricky part of this is that ratings are stored in iTunes' own itl database instead of with the song file, which means that anything you do will have to be using iTunes' interface so that you can use its library. If you're up for that, wongcorgi has the right idea.

Have a look at this StackOverflow question for starters; iTunes + Perl docs are here.

Incidentally I don't think WCityMike's way will work; it won't preserve the iTunes ratings.
posted by katrielalex at 9:23 AM on November 13, 2009


Why would renaming the file affect the rating in the ID3 in any way?
posted by turkeyphant at 9:25 AM on November 13, 2009


The best way would be to use AppleScript to rename the files directly in iTunes. iTunes will automatically update the filename with the new one.

I have a script that can rename selected items using a list, but it doesn't do any checks against the existing name. As long as the old names and the new names are sorted the same it should work.
posted by the biscuit man at 10:12 AM on November 13, 2009


Response by poster: I ended up using A Better Finder Rename as per WCityMike's recommendation. After a couple tests and backups, I discovered that when I renamed the file inside of my itunes folder, that the name updated in Itunes as well and kept the same ratings. Thanks!
posted by jlowen at 5:50 PM on December 6, 2009


« Older Help me help her!!   |   Why am I working so hard at quitting this job? Newer »
This thread is closed to new comments.