Use Text Edit to make changes to iTunes library?

Hello,
I would like to make a number of changes to my iTunes library, such as hundreds of genre changes. My limited knowledge of coding tells me that using a text editor to make changes to the iTunes Music Library.xml file would be a great way to do this. I tried it and everything went smooth, but none of the changes stuck. I do have the correct file as I can see changes that I make from the Get Info dialogue box in iTunes. I did remove the iTunes Library database and reimport after the changes were made, and iTunes had been restarted.
Is it possible to edit the library in this manner?
Could anyone point me in the direction to figure this out?

Cheers,
Ryan


iMac G5 17 PPC 2GHz 2G RAM Mac OS X (10.4.6)

iMac G5 17 PPC 2GHz 2G RAM, Mac OS X (10.4.6)

Posted on May 26, 2006 1:51 PM

Reply
11 replies

May 26, 2006 2:33 PM in response to RQ

A better way would be to create a Smart Playlist for the specific genre you wish to change. Then, highlight all of the songs, and do a Get Info on them. That way you can change all of the genres within iTunes.

The reason the TextEdit method didn't work was because most of the information is likely stored in ID3 tags in the music file itself.

-Ryan

May 31, 2006 5:56 PM in response to RQ

While standard tag information is stored in the file, not all the information iTunes tracks is contained in tags. Also, although tags are stored in files, iTunes still needs a way to keep track of playlists - both the simple kind and the conditions for smart playlists. Keeping all the information in one place makes it easier for iTunes to sort through everything and not have to go to every individual file to grab tag info when, for example, you create, modify, or delete playlists. There is a bit of redundancy, but that redundancy leads to a quicker response from iTunes when you do something.

May 31, 2006 6:39 PM in response to RQ

Ryan has the elegant, iTunes way to do the job. But, RQ, I don't see why your method didn't work. I've done it myself a couple of times--editing the .xml file, throwing out the library file, opening iTunes and letting it build a new library file by importing the edited .xml file. That sounds like what you described, but I guess the devil is in the details.

For the sake of discussion, I think the purpose of the .xml file is to allow data transfer from iTunes to other programs. I cannot think of a practical example off the top of my head; maybe others will know. The iTunes Library file is the all-important database file for the iTunes application. The .xml file is a real time mirror of the library file, only in .xml format. iTunes can function perfectly well in the absence of the .xml file but can do nothing without the library file. I agree that there is some tag information in the music files themselves, and that probably is available to all compatible music players. iTunes appears to maintain those tags, but it relies on its "proprietary" database, the iTunes Library, for its own operations. Just my take.

May 31, 2006 7:26 PM in response to Jase the C

I wrote:
the .xml file is to allow data transfer from iTunes
to other programs. I cannot think of a practical
example off the top of my head; maybe others will


Duh. One purpose of the .xml file is allow you to import another user's iTunes library into your own. You can't directly import someone else's library file, but you can do the equivalent using the .xml file. Importing a library using its .xml file preserves all of the metadata. Adding the same set of songs through Add to Library does not.

May 31, 2006 9:03 PM in response to Jase the C

Thanks all for the great responses. Jase, I will try editing the xml file some more to see if I can get that method to work. I think I may have reimported rather than rebuilt the library the first time around-perhaps information in the library overwrites the xml file. I'll post back after spending some time with it.

Thanks,
Ryan

Jun 10, 2006 4:07 PM in response to RQ

I still can't figure out how to effect changes in the iTunes library by editing the xml file. I tried a couple approaches and both seem to confirm that the library overwrites the xml file.

1. Removed the library and restarted iTunes: A new library was created, empty of course, and the xml file reflected this i.e. it was also empty (except for the headers, etc.)

2. Removed the library, edited and re-saved the xml, then dragged the library back in: The xml file reverted to its pre-edit state.

It seems the xml file is simply a reflection of the iTunes library, and as such changes to song info, playlists, etc can only be made using iTunes. Jase, what am I missing? Can anyone help explain what the relation between the library and the xml file is?

happy listening!
Ryan

Jun 10, 2006 11:10 PM in response to RQ

I still can't figure out how to effect changes in the
iTunes library by editing the xml file. I tried a
couple approaches and both seem to confirm that the
library overwrites the xml file.


Yes, that's true.

1. Removed the library and restarted iTunes: A new
library was created, empty of course, and the xml
file reflected this i.e. it was also empty (except
for the headers, etc.)

2. Removed the library, edited and re-saved the xml,
then dragged the library back in: The xml file
reverted to its pre-edit state.

It seems the xml file is simply a reflection of the
iTunes library, and as such changes to song info,
playlists, etc can only be made using iTunes.


Yes, right, again. I don't think you've done quite what I have in mind yet.

Try it this way. Close iTunes. Drag the library file somewhere else for safekeeping. Edit the XML file. Open iTunes. It will be empty, as you saw in your trial #1. Now, Import the edited XML file. That will populate your iTunes library with the contents of the edited XML file.

I hope this works for you. I've used this method for a couple of chores. I will say that I ran into unexpected results once, with iTunes not being able to find some songs listed in the XML file at Import, even though I had not touched the song files or the song entries in the XML file. It feels like iTunes-iTunesLibrary-XMLfile-Finder integration can mysteriously intervene at times.

But as long as you keep your original library file somewhere and don't move the song files around, it's easy to restore the previous state, so there's no big risk in trying this out.



iMac G4 17; iBook G4 1.33 Mhz 14; iPod 3G 20GB Mac OS X (10.3.9)

Jun 11, 2006 6:39 AM in response to Jase the C

Everything I've ever wanted to do as far as editing song info has been done successfuly within iTunes. I have corrected album titles, artist name spellings, genre, disc number and added comments on multiple songs at one time. The only thing I've ever done eith the .xml file was import it into Excel to make a spread sheet of my library (for my DJ business). Don't make it more difficult than it needs to be.

If you want to change genre, click on the genre column to arrange by genre, then click on the first title and shift/click on the last to highlight all the songs with the genre you want to change. The CMD/I to open the edit window and there you go. It couldn't be easier.

Tracy

Jun 11, 2006 7:16 AM in response to Jase the C

Success!
Thanks Jase.

I was missing the iTunes>File>Import step
So here is what worked for me (as was suggested)
1. Close iTunes
2. Remove the iTunes Library from the iTunes folder
3. Open the xml file with a text editor, make changes, save
4. Open iTunes
5. Select File>Import
6. Select the xml file
7. Wait while iTunes creates a new library based on the edited xml file
8. Realize that iTunes has added all your podcasts to the main library and dropped your podcast subcriptions
9. Feel satisfied that you know how to make changes this way, but decide for most practical purposes it makes more sense to make changes to the library using iTunes' various searching, sorting, and get info abilities.

Thanks everyone for you help and comments!

Happy Listening,
Ryan

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.

Use Text Edit to make changes to iTunes library?

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