扫描 iTunes 资料库?
我正在开发一个 Mac 应用程序,我需要它来扫描用户的 iTunes 库。知道我该怎么做吗?该应用程序将扫描库寻找不同的歌曲属性。
I'm working on a Mac app and I need it to scan the users iTunes library. Any idea how I would go about this? The app would scan the library looking for different song attributes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要查找 iTunes 库的实际最新位置(而不希望它位于默认位置),请读取
~/ 中的
。iTunesRecentDatabases
或iTunesRecentDatabasePaths
属性库/首选项/com.apple.iApps.plist如需更高级的代码片段,请在 iMedia 的 IMBiTunesParser.m
对于实际的数据库解析,建议使用 SAX 解析器,例如
NSXMLParser
(相对于树解析器,例如NSXMLDocument
或更糟:NSPropertylistSerialization
),因为某些用户拥有的库包含多达(有时甚至超过 100,000 个轨道)。使用树解析甚至序列化会严重减慢速度并可能暂时阻止您的应用程序。To find the actual most recent location of the iTunes library (and not hope for it to be at the default location) read the
iTunesRecentDatabases
oriTunesRecentDatabasePaths
property from~/Library/Preferences/com.apple.iApps.plist
.For a more advanced code snippet look for
parserInstancesForMediaType:
in iMedia's IMBiTunesParser.mFor the actual database parsing it is recommended to use a SAX parser, such as
NSXMLParser
(vs. a tree parser, such asNSXMLDocument
or even worse:NSPropertylistSerialization
) as some users have librares with up to and sometimes even more than 100,000+ tracks. Using tree parsing or even serialization will seriously slow down and potentially block your app temporarily.