Is it possible to edit the iTunes "Date Added" field without resetting the system clock?
February 2, 2009 10:41 AM   Subscribe

Is it possible to edit the iTunes "Date Added" field? I am trying to relocate all of the music in my iTunes library from one computer to another and have had no luck keeping the "date added" field in tact. I am willing to manually edit the date added field for every album to match my old database. Is there an easier way to do this other than to constantly reset my system clock? I have over 1100 albums!
posted by anthropomorphic to Technology (15 answers total) 2 users marked this as a favorite
 
If you are just trying to duplicate your library, use rsync (command line; probably there are GUI versions available), and your files and metadata will be copied exactly, preserving file modification times and song metadata in your files. The steps are:

1. Quit iTunes on all computers
2. Rename iTunes folder on new computer to iTunes.backup or whatever
3. Copy iTunes folder from old computer to new computer using rsync
4. Put folder you created in #3 in Music folder
5. Start iTunes on new computer, verify everything
6. Delete iTunes.backup

I keep a library synced between desktop and laptop this way, works fine.
posted by ldenneau at 11:01 AM on February 2, 2009 [1 favorite]


Don't think so. It's not a tag that gets written in the file like most of the others, but a value instrinsic to the XML database that iTunes creates when you make a new library.

I struggled with this, then just gave it up after a couple of major library transfers.
posted by Aquaman at 11:02 AM on February 2, 2009


I believe the "Date Added" field is among the metadata managed by iTunes in a SQLite db which is stored as bad XML in the file "~/Music/iTunes/iTunes Music Library.xml". Ad hoc munging of this XML isn't fun, but iTunes exposes an SDK in several ways that allows you to manipulate the data. You should be able to whip up a simple script that exports the Date Added field from your old library, and then applies the dates to the new iTunes installation.

You don't say what operating system you're working on, but there are a number of ways to access this SDK depending on your OS and scripting language of choice.

* http://developer.apple.com/documentation/Cocoa/Conceptual/RubyPythonCocoa/Articles/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40005424-SW10
* http://developer.apple.com/sdk/itunescomsdk.html
* http://www.codeproject.com/KB/cpp/iTunes_interact.aspx

And, from mefi:
* http://ask.metafilter.com/35892/How-do-I-programtically-access-and-modify-music-metadata-entries-through-iTunes
posted by doteatop at 11:12 AM on February 2, 2009


Response by poster: doteatop: i thought that iTunes recreated the database from its .litl file, not the .xml file. See my assorted fumblings with this in this thread.

would these scripts allow me to edit the .itl file? i'm on vista.
posted by anthropomorphic at 11:23 AM on February 2, 2009


Well, I'm staring at a 641-album library that I copied as I described and the Date Added field matches exactly with the original, item for item. The point is to just copy everything: SQLite DB, XML files and all. Feel free to do it the hard way though!
posted by ldenneau at 11:36 AM on February 2, 2009


Hmm, looks like you're right: http://support.apple.com/kb/HT1660. Also this tip suggests that iTunes can import from the XML.

Using the SDK though allows you to write changes to the in-memory SQLite db, so, hopefully to the .itl and .xml files.
posted by doteatop at 11:38 AM on February 2, 2009


ldenneau:

The point is to just copy everything: SQLite DB, XML files and all. Feel free to do it the hard way though!

If you can copy everything, that's great. Some of us aren't so lucky. Like in anthropomorphic's earlier comment, if the path to the music library changes then iTunes won't be able to match the metadata to the file.
posted by doteatop at 11:41 AM on February 2, 2009


IIRC, when I imported from the XML due to a corrupted binary databse, it kept most of the data but replaced all the date added dates.
posted by smackfu at 1:03 PM on February 2, 2009


Response by poster: @smackfu. yep, that's what happened to me.

it is absurd that this seems to be a problem without remedy.
posted by anthropomorphic at 2:05 PM on February 2, 2009


Y'know - I'll have to check when I get home but I think I just did this very thing a week ago when I got my new Mac. I'm not positive, though.

I had a Dell laptop PC, with iTunes on it, but all the music was stored on an external hard drive. So the library had everything listed as F:

I was moving to a new iMac, and wanted to locate the songs onto the actual iMac hard drive.

If I recall the steps correctly: on the PC, I set iTunes preference to "let iTunes manage my library" and then "consolidated" it (File - Library - Consolidate library.) (It turned out there were a few stragglers on the actual laptop, purchased from Amazon, so this brought everything together into one big music folder, and made sure the iTunes Library file had all the subfolders right.)

Then I started iTunes on the Mac, checked the same "let iTunes manage" and "copy files into ITunes Music folder" preferences, then quit iTunes. In Finder, navigated to the folder where the iTunes library files that were just created were.

Then I both connected the external drive to the Mac AND copied over the "iTunes Library.itl" and XML files into the Mac's iTunes folder.

I'm a little vague on the next step - I think next I opened the Mac's iTunes, which actually was ok because the files were still on the external drive, so the file path data wasn't actually wrong? Then I just made sure the Mac's iTunes had the "iTunes music" folder set to be on the actual Mac hard drive, and did the "consolidate library" step again. It copied everything over onto the Mac.

I'm not 100% positive about the "date added" field, but I'm about 90% positive it carried over. I know that in all other ways, my iTunes library is working on the Mac as if it had been there all along - all my playlists and play counts carried over from the PC to the Mac intact. The only thing that didn't all come over intact that I know of is some album art went oddly missing, and not in any sort of pattern or reason I could decipher.
posted by dnash at 2:35 PM on February 2, 2009 [1 favorite]


Ok, now that I'm back home I can confirm that yes, all my original "date added" data DID transfer from my old PC/laptop onto my new iMac, using the method I described above.
posted by dnash at 5:43 PM on February 2, 2009


if the path to the music library changes then iTunes won't be able to match the metadata to the file.
This is why you always alias ~/Music/iTunes/iTunes Music to wherever your music really is. Er, assuming Windows has aliases/symlinks
posted by bonaldi at 6:51 PM on February 2, 2009


Best answer: I can categorically say that you cannot modify the Date Added data from script or the iTunes COM SDK. It's a read only field.
posted by Dunwitty at 12:12 AM on February 3, 2009 [2 favorites]


Response by poster: @bonaldi: not sure what you mean. can you explain?
posted by anthropomorphic at 2:01 PM on February 7, 2009


Sorry, what I mean pretty much only applies to Macs, which can have folders that are actually aliases to other folders. So as far as iTunes is concerned, my music has always been in the "iTunes Music" folder in my home directory, but in reality it's been on about four different external drives.

When I move all my music onto a bigger disk, I only have to change what the alias folder points to, and iTunes need know no more about it.
posted by bonaldi at 10:03 AM on February 8, 2009


« Older Transfer grad programs?   |   Sanity check my Mac media center. Newer »
This thread is closed to new comments.