Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: iTunes and persistent ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes and persistent ID



Emmanuel wrote:

Note that persistent IDs are completely unreliable in AppleScript.
[...] AppleScript throws away the bottom twelve bits [...] different
IDs can (and often do) appear as the same number in AS.

That's a very important warning.

However I find that (in practical situations) "completely" and
"often" are slightly exaggerated here.

Suppose you've got 10,000 tracks in your iTunes library. Then since
you are storing only 52 bits (which makes more than hundreds
thousands of billions different numbers, 10^14+) instead of 64 two
different IDs will appear the same with probability less than
1/10,000,000,000.

That might be true if ids were generated randomly, but they're not. Persistent ids use both the most and least significant bits, so there's almost always a loss of precision in the bottom 12 bits. If the 52 most significant bits are the same - and they often are - then a collision will occur. I've seen several collisions in a hundred- track playlist, for example.


...

Dave Dribin wrote:

The 'persistent ID' property is in iTunes 6.0.2, but not in iTunes
6.0.1.

That's what Doug's AppleScript site says, too. Do you know this from looking at the 6.0.1 dictionary?

I checked copies of 6.0.1 and 6.0.2 here, yes, and it seems reasonable to assume if it wasn't in 6.0.1 then it wasn't in anything earlier.



Persistent IDs are safe to use in C and in Python+appscript,
however, as those correctly preserve the original 64-bit value. Not
sure about Perl+Mac::Glue; you'd need to check.

I'll be calling from C, so this looks promising.

As long as AppleScript isn't involved - i.e. you call iTunes using the Carbon Apple Event Manager API only - then you'll be okay.


has
--
http://freespace.virgin.net/hamish.sanderson/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.