Re: Itunes - persistent ids not unique (or, managing double integers)
Re: Itunes - persistent ids not unique (or, managing double integers)
- Subject: Re: Itunes - persistent ids not unique (or, managing double integers)
- From: Stan Cleveland <email@hidden>
- Date: Fri, 10 Mar 2006 18:03:17 -0800
- Thread-topic: Itunes - persistent ids not unique (or, managing double integers)
On 3/10/06 4:15 PM, email@hidden wrote:
> Ive got some applescript that is supposed to find a track, given its
> persistent id.
>
> looking at the persistent ids of all the tracks in the xml file
> produced by itunes, they are all different - as expected, and appear to
> be alphanumeric.
>
> however running the code below finds every track in the library.
>
> I assume this is because somehow the persistent id is somehow being
> mangled or coerced into a different type.
>
> Its type is listed as being double integer in the itunes dictionary.
>
> I am running this applescript on 10.3.9 against the latest version of
> itunes.
>
> so, what am I doing wrong? any suggestions welcome.
>
> tell application "iTunes"
> tell playlist "Library1"
> set t to track 1
> set pid to (t's persistent ID)
>
> -- display dialog (dbid as double integer)
> set t to (every track whose persistent ID is pid)
> repeat with this_track in t
> display dialog (the name of this_track as string)
> end repeat
> end tell
> end tell
I believe you're seeing a rounding error where the four least significant
digits are being lost. As a result, more that one song may end up with the
same truncated ID.
-4187747526704881234 ==> -4.18774752670488E+18
-4187747526704885678 ==> -4.18774752670488E+18
-4187747526704889999 ==> -4.18774752670488E+18
An alternative unique identifier in iTunes is a particular "file track id"
of a particular "library playlist id" of a particular "source id".
file track id 5681 of library playlist id 3216 of source id 38
file track id 5682 of library playlist id 3216 of source id 38
file track id 5683 of library playlist id 3216 of source id 38
Perhaps you can figure out a way to do what you want using these.
Stan Cleveland
Color Technology Inc.
Portland, Oregon
"Difficulties increase the nearer we get to the goal." -- Goethe
_______________________________________________
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