开发者

Cocoa Scripting Bridge to put all song names into an array

Could someone show me some c开发者_如何学编程ode that puts all the songs names in the user's music library into an array? Then show me how to change song names to artists, albums etc.


Basically this:

id iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
NSArray *allTrackNames = [iTunes valueForKeyPath:@"sources.@distinctUnionOfArrays.playlists.@distinctUnionOfArrays.tracks.name"];

It will also include things that you might not consider "music" such as podcasts, so you'll probably want to adapt it a bit, but this is basically how you do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜