获取将MPMediaItem添加到iTunes资料库的日期 [英] Get date when MPMediaItem was added to iTunes library
问题描述
有可能吗?我没有在MPMediaItemProperty ...字符串中找到类似的东西.也许是私有API?
Is it possible? I haven't found anything like this in MPMediaItemProperty... strings. Maybe private API?
推荐答案
在文档中,方法列表中没有相应的字段.这样,您就可以选择为自己的添加日期"字段将MPMediaItem
扩展为新的MPMediaItemProperty
.当然,这只会向前发展.
Looking through the documentation, the methods list doesn't have a field for it. This leaves you with the option of extending MPMediaItem
with a new MPMediaItemProperty
for the 'date added' field yourself. Of course, this only works going forward.
或者,您可以解析iTunes Library XML项并将字段与正在使用的MPMediaItem
进行比较.对于'Date Modified',有一个key
标签,具有常规的文件系统'Date Modified'信息(大概是从将文件添加到iTunes时开始),但是基本上是在文件被翻录或添加时,除非您进行了修改.您的MP3文件.因此,这并不是严格意义上的,而是我能想到的最接近的通用类似物.
Alternatively, you could parse the iTunes Library XML item and compare fields to the MPMediaItem
you're using. There is a key
tag for 'Date Modified' that has the conventional filesystem 'Date Modified' information (presumably from when the file was added to iTunes), but which is basically when the file was ripped or added unless you're modifying your MP3 files. So it's not strictly what you're looking for, but it's the closest general analogue I can think of.
您可能想看看是否有直接从文件或MPMediaItem
中找到Track ID密钥的方法,它可以使您更快地搜索iTunes Library XML文件.尝试基于MPMediaItemPropertyPersistentID
的方法-其中一种应与iTunes Library XML文件的"Persistent ID" key
字段中的十六进制标识符相对应.
You may want to see if there is a way of finding the Track ID key directly from the file or MPMediaItem
as well which may give you a faster search through the iTunes Library XML file. Try the MPMediaItemPropertyPersistentID
-based methods---one of these should correspond to the hex identifier in the 'Persistent ID' key
field of the iTunes Library XML file.
这篇关于获取将MPMediaItem添加到iTunes资料库的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!