我为漫画文件创建了一个聚光灯导入器。属性已成功导入并可搜索。剩下的一件事是让属性显示在文件的获取信息窗口中。
似乎这应该是编辑 schema.xml 文件的简单问题,因此属性嵌套在 displayattrs 标记中。不幸的是,这似乎不起作用。
我简化了测试插件。以下是所有重要文件。
架构.xml
<types>
<type name="cx.c3.cbz-archive">
<allattrs>
kMDItemTitle
kMDItemAuthors
</allattrs>
<displayattrs>
kMDItemTitle
kMDItemAuthors
</displayattrs>
</type>
<type name="cx.c3.cbr-archive">
<allattrs>
kMDItemTitle
kMDItemAuthors
</allattrs>
<displayattrs>
kMDItemTitle
kMDItemAuthors
</displayattrs>
</type>
</types>
GetMetadataForFile.m
Boolean GetMetadataForFile(void* thisInterface,
CFMutableDictionaryRef attributes,
CFStringRef contentTypeUTI,
CFStringRef pathToFile)
{
NSAutoreleasePool * pool = [NSAutoreleasePool new];
NSString * file = (NSString *)pathToFile;
NSArray * authors = [[UKXattrMetadataStore stringForKey: @"com_opencomics_authors" atPath: file traverseLink: NO] componentsSeparatedByString: @","];
[(NSMutableDictionary *)attributes setObject: authors forKey: (id)kMDItemAuthors];
NSString * title = [UKXattrMetadataStore stringForKey: @"com_opencomics_title" atPath: file traverseLink: NO];
[(NSMutableDictionary *)attributes setObject: title forKey: (id)kMDItemTitle];
[pool release];
return true;
}