Search code examples
macoscocoaitunes

Editing iTunes Library in Cocoa


I want to edit the "Date Added" attribute of my music files, i thought i could do this using AppleScript, but this attribute is read only.

Then i found a file named "iTunes Music Library.xml", this file can be edited, but the changes will be over-written by iTunes.

It seems like i should edit the "iTunes Library.itl" file which is in the same folder, but how can i do this? or is there any other way to do this?

Thanks and sorry for my English.


Solution

  • The rationale for the Date Added property being read-only is that it represents the date that the file was added to the iTunes Library.

    The .xml file is only used when you want to re-import your files into iTunes, it is rewritten on pretty much any change to the library.

    There's a library for understanding the format of the .itl file called titl. I don't know if it supports the latest version of the library file format, though.

    You may need to refer to the PicardPlugins wiki for more information/ways to read/modify the library file. Changes that have happened over time are the compression of the content, and the encrypting of the data.

    I would expect that you should only modify this file when iTunes is not running, though.