com - 需要有关 iTunes COM 持久 ID 的解释。将轨道传输到 iPod 时,轨道 ID 是否相同?

标签 com javascript ipod itunes-sdk

我正在用 iTunes COM api 编写一个 JScript 脚本,用于将 iPod 数据库中的 ratingsplayed count 更新回 iTunes Library。为此,脚本应该能够识别从该 iTunes 库传输的歌曲,以便它可以读取 iPod 上轨道的评级数据并更新 iTunes 库中的相应轨道

这是我写的代码:

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
}

根据 iTunes COM API

You can retrieve a 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

现在的问题是:

  1. 当轨道传输到 iPod 时,iTunes 库中轨道的 64 位持久 ID 保持不变,我说得对吗?
  2. 我使用 ITObjectPersistentIDHigh()ITObjectPersistentIDLow()
  3. 的方式有什么问题吗?
  4. 有没有完全不同的方法来做到这一点?

PS:测试iPod上有662首歌曲,所以没有问题

非常感谢任何帮助!谢谢!

最佳答案

如果你有最新的nano,并且开启了画外音功能,那么ID会变,否则不会。我试图弄清楚 SW 如何知道在您同步时更新播放次数和时间,因为 ID 不相同。

关于com - 需要有关 iTunes COM 持久 ID 的解释。将轨道传输到 iPod 时,轨道 ID 是否相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1633215/

相关文章:

iphone - 透明UIImage

c# - 在 C# 中使用 Scripting.Dictionary

c++ - 在 com 中创建字符串数组

c# - 尝试在 C# 中打开 Word 应用程序时出错

c# - 将托管事件源连接到非托管事件接收器

javascript - 链接 HTTP post promise Angular 不按顺序

javascript - 如何清除Timeout这个函数?

javascript - 在javascript中声明静态变量

iphone - 新手想要为 ipod touch 创建 PDF 阅读器 - 最好的方法是什么?

ios - 通过 UIImagePickerController 使用相机在 iPod 上崩溃