Need an explanation for the permanent iTunes IP address. Is the ID for the track the same when transferred to the iPod?

I am writing a JScript script with iTunes COM api to update ratings

and played count

from iPod database back to iTunes Library. For this to work, the script must be able to recognize songs that have been transferred from that iTunes library so that it can read the rating data for a track on the iPod and update the corresponding track in the iTunes library

Here is the code I wrote:

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 <= 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
}

      

According to iTunes COM API

You can retrieve the source, playlist, or track with a specified persistent ID using the ItemByPersistentID property of the appropriate collection Interface

ItemByPersistentID returns an IITTrack object with the specified persistent ID

Now the questions:

  • I am correct in saying that the 64-bit Persistent ID for a track in the iTunes Library remains the same when the track is transferred to the iPod.
  • There is something wrong with the way I am using ITObjectPersistentIDHigh()

    andITObjectPersistentIDLow()

  • Is there any other way to do this at all?

PS: There are 662 songs on the test iPod, so there is no problem.

Any help is greatly appreciated! Thnx!

+2


source to share


2 answers


If you have the latest nano and turn on the voice call function, then the ID will change, otherwise it won't happen. I'm trying to figure out how SW knows to update the play count and play time when you sync, since the id doesn't match.



0


source


I don't think there is only one way to do this, very long: compare for each track on the iPod the names, albums, lengths, etc. with the one you have in your library. However, I don't think it would be a very efficient solution, just "easy to program".



I used persistentID just like you did (albeit in a playlist). It should work ... Maybe you should set the parameter to be int ...

0


source







All Articles