How does iTunes track / identify a song in its music library?

This may not sound like a programming problem, but I'm trying to implement a similar rating function like iTunes, and I'm wondering how iTunes tracks a song like this:

After I rate a song in iTunes, although I change the meta tags (artist / title / album) it can match the song and show the rating, and even I move the file to another folder or change the file name, the rating is still there, I am a little digging around and found in "iTunes Music Library.xml" there is a "persistent id" for each song, i think "persistent id" is the key, but i'm still confused how iTunes maps "persistent id" to a song, even if user can change filename / meta tag of audio file.

any idea?


source to share

All Articles