• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iTunes and persistent ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes and persistent ID


  • Subject: Re: iTunes and persistent ID
  • From: has <email@hidden>
  • Date: Sat, 26 Aug 2006 20:43:16 +0100

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
  • Prev by Date: Re: Look for prefix, if no match display alert.
  • Next by Date: A few questions about dates
  • Previous by thread: Re: iTunes and persistent ID
  • Next by thread: Re: Desktop Picture not persist across reboot
  • Index(es):
    • Date
    • Thread