I would simply say that your Library is corrupt for some reason. As your library is a virtual reference lookup to your actual music files, if it has a problem it is possible that it will either give you issues at program startup or perhaps when you add something to your library as it will read the reference file and encounter issues when trying to add to it.
I first of all tried all the obvious, Disk Utility
repair, permissions, deleted and reloaded iTunes, etc. However all of that will still use the original Library file so it won't solve the issues so many are having with iTunes.
The simplest yet time related route is to rebuild your library. What this means is that you need to create a new one, and import all your content again. It may take you 30 minutes and for your computer 10 hours.
As it's your library that's corrupt and not the actual files/file structure that is the problem you will be able to import all of your music again together. About 95% of your albums will be kept together although in some occasions with downloaded albums their reference name will not match that of the official release so it may be separated and in need of the artwork but neither is a big take to sort out. It's the same deal with your movies.
- Quit iTunes
- Hold Alt and click iTunes again
- Select new Library (don't worry your old one is still there and will not be deleted)
- Then you can start to rebuild. You can always go back to your old Library by closing iTunes, holding Alt and clicking on iTunes.
To select which library to open - you will see that in your Music/Itunes folder there are now two libraries and the xml library file is in the sub folder for each for you to select if you cant find it. Give yours a simple name when you create it such as 'ITunes Library 2' that way you can search for it too if you can't find it.
The only issue with this method is having to backup your iPhone/iPad or other device in your old Library as it can only be sync'd with one library. However, once you are happy with your new library you can Erase your device and sync it with your new Library.
When you erase your iPhone for example, it will only wipe/erase the content (Music, Movies, etc.) it will not delete Apps, Messages, Bookmarks, Photos, etc.
I hope this helps, as it not only sorted my iTunes issues for good but also made my iMac a lot faster in general as iTunes is not struggling and does not crash any more.
I dissected the XML file a bit and it turned out to be a XML property list (sort of a XML-based JSON equlivant), so it becomes easier to handle. If the files affected have the same name not counting its extension, some Objective-C can be laid down to change it. Do you have Xcode installed or should I prepackage it for you?
Best Answer
The best way to preserve your playlists is to manage them, as far as possible, within iTunes.
It seems to me from your question and comment that the biggest issue arises when you rename a file you've previously added to a playlist. However, instead of renaming the file within your operating system, you should do it within iTunes. One way to do this is:
Managing all of this via iTunes will ensure you don't break your playlists.
Also, you may want to check your advanced settings within iTunes and play with the Keep iTunes Media folder organized and Copy files to the iTunes Media folder when adding to library options to determine what works best for you.