case of the missing files


April 17th, 2007

iTunes will, every so often, decide to lose track of some of my songs. This hasn’t happened often and generally it always fixed itself up after me indicating where just one of those songs was. But last night, things got a whole lot different. A relatively simple fix later, everything’s back to normal. What I lost? Play Counts :(

Why is this any better than just erasing everything from your library and starting all over again? Well, you keep your artwork, your podcasts, your ratings and your playlists. And, when you had - like me - about 1100+ songs to have to re-teach iTunes about, losing some 3000+ play count information seemed like a reasonable trade-off. After all, I did actually listen to more than just those 3000 so it wasn’t that accurate. But having to re-assign artwork and ratings [which are more relevant to me regarding my tastes that just the play count] was not a feasible course of action.

On with the ‘fix’. The beauty of the matter is that “iTunes Music Library.xml” is a plain text file. And it literally contains all the information one needs to keep track of one’s songs. So some of my files were thought of - by iTunes - to be located on a USB drive [let's call it USBD] while others in the default location [~/Music/iTunes/]

Fire up the terminal. Go to the Library file in ~/Music/iTunes and run

sed s/”\/Users\/inaequitas\/Music\/iTunes\/”/”\/Volumes\/USBD\/”/g iTunes\ Music\ Library.xml > iTunes\ Music\ Library2.xml

cp “iTunes Music Library.xml” “iTunes Music Library.old.xml”

cp “iTunes Music Library2.xml” “iTunes Music Library.xml”

Always be careful with sed, you might mess something up. Upon completion, iTunes will now know where your files really are. Well, not yet.

There is another file, a binary representation of [more or less] the same thing: “iTunes Library”. The two seem to work together to some extent and so upon firing up iTunes again you’ll be faced with the same situation; what’s more, your xml got changed back to the way iTunes thinks your songs are set. So, in order to get around this, you really need to delete/move that file also and start up iTunes blank. At this point you can tell it to import your xml file and you are good on your way, minus some settings in the playlists and your podcasts subscriptions [which still show up but you must click subscribe one more time; on a side note, I also found out iTunes did not delete all the past podcasts that it was supposed to.] And, of course, the play count, which iTunes seems should be reset because your Library is new - to it, at least. Manually inserting the relevant values does not help - iTunes will erase from the xml what it does not know of.

Hopefully this might be of some use to others that experience this random change of location. One caveat is that I let iTunes copy and organize my music as I add it to the library. The solution I have provided is probably helpful for those that use iTunes with an external HDD or a network drive where the mapping may change but the arrangement of the files does not.

  • TwitThis
  • del.icio.us
  • StumbleUpon
  • Google
  • Technorati
  • YahooMyWeb
  • Live
  • Slashdot
  • Digg
  • Reddit
  • Facebook
  • Mixx

Post a Comment


«stupid PR ideas | home | too many ‘tards»