Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed an explanation on iTunes COM persistent ID. Is the ID for a track same when its transferred to an iPod?
    text
    copied!<p>I am writing a JScript script with iTunes COM api for updating <code>ratings</code> and <code>played count</code> from the iPod database back into iTunes Library. In order to do so, the script should be able to recognize the songs that were transferred from this iTunes Library, so that it can read the ratings data for the track on iPod and update the corresponding track in the iTunes Library</p> <p>Here's the code I've written:</p> <pre><code>var iTunesApp = WScript.createObject("iTunes.Application"); var mainLibrary = iTunesApp.LibraryPlaylist; var iPodLibraryPlaylist = playlists.Item(1); // get the main iPod Library playlist(leaving the unimportant portion) for(j=0; j &lt;= iPodLibraryPlaylist.Tracks.Count - 1; j++) { foo = iPodLibraryPlaylist.Tracks.Item(j+1); // j+1, coz this index is 1-based (why apple...why?) bar = mainLibrary.Tracks.ItemByPersistentID(iTunesApp.ITObjectPersistentIDHigh(foo), iTunesApp.ITObjectPersistentIDLow(foo)); WScript.StdOut.WriteLine(bar.Name); // should print the name of the track, but throws runtime error: Object required } </code></pre> <p>According to the iTunes COM API</p> <blockquote> <p>You can retrieve a source, playlist, or track with a specified persistent ID using the ItemByPersistentID property of the appropriate collection interface</p> <p>ItemByPersistentID returns an IITTrack object with the specified persistent ID</p> </blockquote> <p>Now the questions are:</p> <ol> <li>Am I right in saying that the 64-bit Persistent ID for a track in iTunes Library remains the same when the track is transferred to an iPod.</li> <li>Is there anything wrong in the way i'm using the <code>ITObjectPersistentIDHigh()</code> and <code>ITObjectPersistentIDLow()</code></li> <li>Is there any totally other way to do this?</li> </ol> <p>PS: There are 662 songs on the test iPod, so there's no problem there</p> <p>Any help is much appreciated! thnx!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload