can you restore your library from an xml file?

my computer crashed but i managed to save the itunes library.xml. i know my music is gone but i would at least like to have the names of all of the songs i am missing. this happened to my friend who managed to import the xml file. she did not have the music on her computer but all of the music did show up on itunes, unplayable of course with an exclamation mark beside them, but the song titles and information were all there. is it possible for me to do this with just an xml file?

Posted on May 16, 2013 4:35 PM

Reply
8 replies

May 16, 2013 5:53 PM in response to leastcommonmultiple

iTunes generally doesn't care about the .xml file. It is provided for third party support and is rewitten every time anything changes in the library. You can import it into an empty library, but it wll only add the tracks that are where they are listed in the .xml. The crucial file is the .itl file. If you have this you can review your library as it used to be. Alternatevely the .xml file can be viewed in a text editor/spreadsheet and with some effort you could drag useful information out of it.


tt2

May 17, 2013 4:06 AM in response to leastcommonmultiple

The .xml should list all the songs, playlists and other sundry data, however deciphering it is a bit tricky. Every time iTunes runs it rebuilds the .xml so you'll need to check that you have a copy that still reflects your former library.


This is an example of the record for one track in the .xml file.


<key>76</key>
<dict>
<key>Track ID</key><integer>76</integer>
<key>Name</key><string>Dunya Salam [Feat. Baaba Maal]</string>
<key>Artist</key><string>1 Giant Leap</string>
<key>Album Artist</key><string>1 Giant Leap</string>
<key>Composer</key><string>Baaba Maal/Duncan Bridgeman/Jamie Catto</string>
<key>Album</key><string>1 Giant Leap</string>
<key>Genre</key><string>Rock</string>
<key>Kind</key><string>MPEG audio file</string>
<key>Size</key><integer>4227148</integer>
<key>Total Time</key><integer>175333</integer>
<key>Track Number</key><integer>1</integer>
<key>Track Count</key><integer>12</integer>
<key>Year</key><integer>2002</integer>
<key>Date Modified</key><date>2013-03-31T19:54:28Z</date>
<key>Date Added</key><date>2013-03-31T16:44:42Z</date>
<key>Bit Rate</key><integer>192</integer>
<key>Sample Rate</key><integer>44100</integer>
<key>Play Count</key><integer>2</integer>
<key>Play Date</key><integer>3450044275</integer>
<key>Play Date UTC</key><date>2013-04-29T00:37:55Z</date>
<key>Artwork Count</key><integer>1</integer>
<key>Sort Album</key><string>000001 Giant Leap</string>
<key>Sort Album Artist</key><string>0001 Giant Leap</string>
<key>Sort Artist</key><string>0001 Giant Leap</string>
<key>Persistent ID</key><string>C670879EAD7AE1C4</string>
<key>Track Type</key><string>File</string>

<key>Location</key><string>file://localhost/E:/iTunes%20Test/iTunes%20Media/Musi c/

1%20Giant%20Leap/1%20Giant%20Leap/01%20Dunya%20Salam%20%5BFeat.%20

Baaba%20Maal%5D.mp3</string>

<key>File Folder Count</key><integer>6</integer>
<key>Library Folder Count</key><integer>1</integer>
</dict>


Extracting the location strings and converting the various character substitutions would give most of the relevant information and looks like the easiest approach. The track above is stored at:


E:\iTunes Test\iTunes Media\Music\1 Giant Leap\1 Giant Leap\01 Dunya Salam [Feat. Baaba Maal].mp3


from which one can infer artist/album artist, album, track number and track name. Would a list of such file paths be useful? I can probably knock up a script for that. Alternatively one could attempt to pull together more of the track information from the other keys. but that would be harder.


I suggest using Notepad++ if you want to explore the contents of the .xml yourself.


tt2

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

can you restore your library from an xml file?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.