This page shows the source for this entry, with WebCore formatting language tags and attributes highlighted.

Title

Synchronizing iTunes Libraries

Description

<img src="{att_link}itunes.png" align="left"> <div style="margin-left: 150px"> This is a synopsis of the instructions I found at <a href="http://blog.jillesvangurp.com/2006/01/09/new-pc-moving-itunes-library/">New PC & moving itunes library</a>, which didn't strike me as concise or to-the-point enough for the less-savvy user. <h>Target Audience</h> This guide is for people who do <b>not</b> let iTunes organize their music for them.<fn> It further assumes that you've already copied your music files (mp3, m4a, ogg, etc.) to the new computer. This guide will show you how to make iTunes on the new computer use the ratings, play count and other information from the old computer. If you have the same folder for music files on both computers, you do not need this guide. This guide will work for transfers between Mac and Windows computers. </div> <hr> <h>Quick Guide</h> <ol> Copy the two iTunes Library files from the iTunes folder on the old computer to the one on the new machine. Using a text editor, open the XML file and search/replace the paths to the music files to point to the correct location on the new computer. Using a binary editor, open the ITL file, delete the entire contents and save it. Start iTunes, let it import the library from the XML file, then press "Yes" when it asks if it's ok to ignore the "corrupted" library file. </ol> <h>Full Guide</h> <h level="4">Overview</h> iTunes stores your music library <i>meta-data</i> in two files, both of which are stored in your iTunes Music folder. This guides will refer to that folder as <c>~/Music</c>; the real location is <c>C:\Documents and Settings\<user>\Music\iTunes</c> on Windows and <c>/Users/<user>/Music/iTunes</c> on Mac OS X. Inside this folder, you'll see two (2) files and two (2) folders. <ul> <c>iTunes Library</c><fn> is a binary file that contains all of your meta-data in a quick-loading database. <c>iTunes Music</c> is a folder that contains all of your imported Music. <c>iTunes Music Library.xml</c> is an XML file that replicates your meta-data in an easy-to-read text format. <c>Previous iTunes Libraries</c> is a folder that contains backup files created during upgrades from other iTunes versions. </ul> Copy the <c>iTunes Library</c> and <c>iTunes Music Library.xml</c> files to the <c>~/Music</c> folder on the new machine. <h level="4">Adjusting paths</h> The next step is to tell iTunes where the actual music files are located. You will have to adjust the library description for each of the song files. Open iTunes Music Library.xml in a text editor<fn>. Inside this file, there are several sections, but mainly two large one: one for tracks and one for playlists. Tracks have many, many fields, but the important one is highlighted below: <div class="detail"><code> <key>Tracks</key> <dict> <key>40</key> <dict> <key>Track ID</key><integer>40</integer> <key>Name</key><string>[Title]</string> <key>Artist</key><string>[Artist]</string> <b><key>Location</key><string>file://localhost/Users/Shared/Music/Funk/[Artist]%20-%20[Title].mp3</string></b> </dict> ... </code></div> The line you will have to change is that for the <c>Location</c> key. In the example shown, the music library is found in <c>/Users/Shared/Music</c>. Replace this string with the location of the library on the new computer. Some tips: <ul> Spaces are indicated with %20<fn> instead of using a real space in the file name. If the location of the library has spaces, make sure to replace them. Do not remove the <c>file://localhost/</c> part at the front of the file name. On Windows, the path should include the drive letter after the localhost portion. For example, if the music library is at <c>D:\Shared\Music</c>, the file location should start with <c>file://localhost/D:\Shared\Music</c> </ul> You will not need to change anything for playlists. <h><i>Trick</i> iTunes</h> If you start iTunes now, it will completely ignore the paths you put in, magically restoring the paths from the old computer and overwriting the file you painstakingly modified. Well done, iTunes. It's actually loading the whole library from the <i>other</i> file, the <c>iTunes Library</c>. As long as iTunes can read from this file, it will not load from the XML file. If you remove the file entirely, iTunes will not load anything. Tricky, but not insurmountable. <ol> Open the <c>iTunes Library</c> in the same text editor as before. It is binary information and is <i>supposed</i> to look like that. Select all of the content and delete it. Save the file; it should be 0 bytes now. </ol> <h>Start iTunes</h> You're done. Start iTunes and it will load the library from the XML file. Once it has imported this file (which can take some time with large libraries), it will ask you if it's ok to ignore the corrupted <c>iTunes Library</c>. Click "Yes" and you're done. <hr> <ft>On Windows, this file has an <c>itl</c> extension.</ft> <ft>That means that both the <c>Keep iTunes Music folder organized</c> and the <c>Copy files to iTunes Music Library when adding to library</c> are unchecked in the Advanced / General tab in the preferences.</ft> <ft>You will need an editor that can search/replace text in large(ish) files. On Windows, notepad should be able to open the file, but a more high-powered editor like <a href="http://www.jedit.org">jEdit</a> is recommended. On the Macintosh, XML files open in the Property List Editor by default. You should use a text editor like <a href="http://www.barebones.com/products/textwrangler">TextWrangler</a> instead.</ft> <ft>20 is hexadecimal notation for 32 in decimal notation. The ASCII code for a space character is 32.</ft>