【发布时间】:2012-05-04 14:03:15
【问题描述】:
问题就在标题中 :) 我正在使用 Objective-C 和 Scripting Bridge。我知道可以从 iTunes 获取信息(只读),但我看不到任何修改曲目的方法,例如更改其名称。用这种或另一种技术有可能吗?
非常感谢:)
【问题讨论】:
标签: objective-c itunes scripting-bridge
问题就在标题中 :) 我正在使用 Objective-C 和 Scripting Bridge。我知道可以从 iTunes 获取信息(只读),但我看不到任何修改曲目的方法,例如更改其名称。用这种或另一种技术有可能吗?
非常感谢:)
【问题讨论】:
标签: objective-c itunes scripting-bridge
嗯,从 AppleScript 编辑器的脚本库中,我可以看到 file_track 继承自 item 并且 item 具有读写属性 name。因此,您应该能够像阅读它一样轻松地设置它。
编辑:实际上,几乎每条元数据都是track 的一部分(其中file_track 也继承了),并且大多数都是读写属性...
Doug Adams 有一个such script 可以更改iTunes 中歌曲的标题。可以看看吗?
至于通过Objective-C设置,或许this documention可以帮到你。
摘自网站:
清单 2-3 设置 Finder 项的锁定属性
int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; FinderApplication *theFinder = [SBApplication applicationWithBundleIdentifier: @"com.apple.finder"]; SBElementArray *trashItems = [[theFinder trash] items]; if ([trashItems count] > 0) { for (FinderItem *item in trashItems) { if ([item locked]==YES) [item setLocked:NO]; // <<<-- Setting the property } } [pool drain]; return 0; }
你试过了吗:
iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
[[iTunes currentTrack] setName:@"The New Song Title"]);
【讨论】: