如何使用 iTunes API“显示”/选择曲目
我通过 C# 使用 iTunes SDK/API。我试图让 iTunes 在音乐库列表中选择特定曲目(即突出显示一个特定行,并且仅突出显示该行)。我一直在尝试使用 Reveal() 方法来执行此操作:
iTunesApp app = new iTunesAppClass();
IITTrackCollection tracks = app.LibraryPlaylist.Tracks;
IITTrack track = tracks.get_ItemByPlayOrder( 50 );
IITFileOrCDTrack fot = t as IITFileOrCDTrack;
fot.Reveal();
但是 Reveal() 调用似乎没有效果。我认为它会(a)如果 iTunes 位于不同的屏幕(例如 iTunes Store 中的专辑详细信息屏幕),则切换到 iTunes 中的音乐库屏幕,(b)滚动音乐曲目列表显示以将给定的项目带入视图,以及 (c) 突出显示列表中给定的轨迹线。
Reveal() 似乎没有做这些。关于如何实现(a)、(b)、(c)有什么想法吗?
I am using the iTunes SDK/API through C#. I am trying to get iTunes to select a particular track in the music library list (i.e., highlight one particular line and only that line). I've been trying to do this with the Reveal() method:
iTunesApp app = new iTunesAppClass();
IITTrackCollection tracks = app.LibraryPlaylist.Tracks;
IITTrack track = tracks.get_ItemByPlayOrder( 50 );
IITFileOrCDTrack fot = t as IITFileOrCDTrack;
fot.Reveal();
But that Reveal() call seems to have no effect. I thought it would (a) switch to the music library screen in iTunes if iTunes was at a different screen (such as an album detail screen in the iTunes Store), (b) scroll the music track list display to bring the given item into view, and (c) highlight the given track line in the list.
Reveal() seems to do none of these. Any ideas on how I can make (a), (b), (c) happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了如何让它工作:你必须选择“用户播放列表”内的曲目!
如果您在未指定播放列表的情况下选择文件曲目(这适用于在 OSX 上使用 AppleScript 编写 iTunes 脚本),则该曲目将从“库播放列表”中选择,该列表在 UI 中没有预呈现,因此无法显示。
因此,如果您确保从用户播放列表中获取该项目,例如“特殊类型”是“音乐”的项目,那么您就可以了。
I figured out how to make it work: You have to choose the track inside a "user playlist"!
If you choose a file track without specifying a playlist (this applies to using AppleScript on OSX to script iTunes), then the track is chosen from the "library playlist", which has no prepresentation in the UI, and thus can't be revealed.
Hence, if you make sure to get the item from a user playlist, e.g. the one whose "special kind" is "Music", then you're good.