How to start with iTunes all over again without losing playlists or ratings.

As crazy as it may seem, I have long managed my music primarily through playlists, smart playlists and ratings. I have quite a few playlists that are simply whole albums, as well as many eclectic mixes and smart playlists of music rated 3 stars or more of different types.

After many years and numerous iTunes updates, things were starting to behave oddly. iTunes was taking a while to open, I was starting to find duplicated playlists and a quarter of my songs had their genre changed to “msng”, which took some un-doing.

After Audirvana refused to sync playlists without leaving most of them empty, I figured it was time for a complete reset. However I didn’t want to lose all the playlists and ratings. With a bit of lateral thinking and Googling I figured out a plan.

First of all, a search revealed that if “Share iTunes Library XML with other applications” is switched on under the Advanced preferences, the file can be used with the “Import Playlist” option under Library in the File menu.

Secondly, to keep all my file star ratings, I created smart playlists for 1, 2, 3, 4 and 5 stars. They only show the songs with those ratings. I exported those playlists as m3u8. This wont work as an XML export, as on import to a new library it will recognise it as a smart playlist and be empty! The m3u8 also supports foreign characters, though regular m3u will probably work too.

Then onto creating a new library.

First of all, I decided on the location. This is important as it was going to affect how I managed the next bit. I have iTunes manage my music and import all files, so I needed to know the UNIX-style path to the new library location. In my case it was on an external hard drive:

/Volumes/Emu II/Music/iTunes

my old iTunes folder was on a different drive:

/Volumes/Amos 2T/Music/iTunes

Note that these paths have a space in the drive name. This is important for later.

I opened iTunes with the option key held down so that it would prompt me to open a library or create a new one. I created a new one in my Emu II drive in the Music folder. Then I dragged my old iTunes Music and iTunes Media folder on to the iTunes window and went off for a few hours while it all imported.

A note here: By default, iTunes used to store music in “iTunes Music” but later on, it changed to using “iTunes Media”. For me, that left a divided library that was a PITA to manage when attempting to synchronise parts of it to other devices. You might not have an “iTunes Music” folder at all.

Once all the music had copied, it was time to import the playlists. I wasn’t sure that importing the old iTunes Library.xml file would work, as inside it, all the songs were pointing to my old Amos 2T drive. So I decided to do a bit of trickery. I opened up the iTunes Library.xml file in BBEdit and did a search and replace, changing the old volume name, “Amos%202T” to the new one, “Emu%20II”. Note that the spaces in the volume name have been replaced with the code for a space (“%20”).

I then imported the saved XML file and immediately had all my playlists back. This may not work for everyone and I ended up with a couple of empty playlists and missing tracks (possibly due to other, un-related issues). Anyone without iTunes set to manage music and import files will not have to muck about with changing file paths in the file as I did, only import the file as it is.

Lastly, I only had to import the 1, 2, 3, 4 and 5 start playlists. Once imported, I selected all the songs in each playlist and opened up the info/edit window and gave them the requisite number of stars. After a bit of beach-balling (it takes a while with a few thousand songs) I had all my ratings back.

Now I have a working iTunes that opens in a couple of seconds instead of 10-20.