Hilfe bei Programmierung von Spotlight Plugin für XMP-Metadaten

M

Mathias T.

Registriert
Thread Starter
Dabei seit
02.08.2007
Beiträge
2
Reaktionspunkte
0
Hallo zusammen,

kennt sich jemand mit dem Schreiben von Spotlight Plugins aus oder konnte hier zumindest erste Erfahrungen sammeln?
Habe für die Verwaltung meiner PDFs Adobes Metadatenpalttform XMP genutzt, um direkt in die PDF Dateien meine Metadaten in Form von XML-Statements zu bekommen.

Im Anschluss daran habe ich nach dem Vorbild des Spotlight Importer Programming Guide von Apple ein Spotlight Plugin geschrieben. Dieses wird in XCode auch ordentlich kompiliert. Wenn ich den resultierenden Spotlight-Importer dann aber in das entsprechende Verzeichnis kopiere und ihm am System anmelde (mit mdimport -r /Dateipfad/Dateiname.mdimporter) wird er zwar aufgenommen (zu überprüfen mit mdimport -L) findet aber weder die von mit in der schemal.xml definierten Attributbezeichnungen noch die Attributbeschreibungen (zu überprüfen mit mdimport -A). Statt dessen bringt er die Fehlermeldung:

2007-08-02 09:43:03.935 mdimport[355] CFLog (0): CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary.
2007-08-02 09:43:03.937 mdimport[355] CFLog (0): CFPropertyListCreateFromXMLData(): The file name for this data might be (or it might not): /System/Library/Frameworks/Foundation.framework/Resources/Languages/en


Die im Importer vom mir selbst definierten Metadaten lassen sich über Spotlight entsprechend auch nicht suchen.

Ich brauche dringend Hilfe!!! Kann mir bei diesem Problem jemand helfen oder weis jemand, an wen ich mir wenden kann, um hier weiterzukommen?

Viele Grüße
Mathias
 
Liest Du denn

/System/Library/Frameworks/Foundation.framework/Resources/Languages/en?

Benutzt Du CFPropertyListCreateFromXMLData?

Alex
 
Nein, dass ist mir nicht bewusst. Hab nur das Framework Foundation eingebunden - war lt. Apple-Anleitung notwendig. Nun hab ich in der Programmierung aber auch eher weniger Erfahrung.

Hier mal meine GetMetadateForFile.m:

#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <Cocoa/Cocoa.h>
#include <Foundation/Foundation.h>

Boolean GetMetadataForFile(void* thisInterface,
CFMutableDictionaryRef attributes,
CFStringRef contentTypeUTI,
CFStringRef pathToFile)
{
/* Pull any available metadata from the file at the specified path */
/* Return the attribute keys and attribute values in the dict */
/* Return TRUE if successful, FALSE if there was no data provided */

/*#warning To complete your importer please implement the function GetMetadataForFile in GetMetadataForFile.c
return FALSE;*/

Boolean success=NO;
NSDictionary *tempDict;

NSAutoreleasePool *pool;
// Don't assume that there is an autorelease pool around the calling of this function.
pool = [[NSAutoreleasePool alloc] init];
// load the document at the specified location
tempDict=[[NSDictionary alloc] initWithContentsOfFile:(NSString *)pathToFile];
if (tempDict)
{
[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Links"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Organisation"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Strasse"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_PLZ"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Ort"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Laufweg"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Vertraulichkeitsstufe"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_WTag"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_WMonat"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_WJahr"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_ATag"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AMonat"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AJahr"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Aussonderungsart"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Rolle"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Status"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Veranstaltungsort"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Zeit"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Tag"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Monat"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Jahr"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Teilnehmer"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Veranstaltungsart"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP1"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP2"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP3"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP4"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP5"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP6"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP7"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP8"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_AP9"];

[(NSMutableDictionary *)attributes setObject:tempDict
forKey:mad:"com_adobe_pdf_Themen"];

success=YES;
// release the loaded document
[tempDict release];
}
[pool release];
return success;
}

Hab aber auch schon überlegt, ob sich mein Plugin mit dem ursprünglichen PDF-Plugin von Apple behackt. Hatte bei Apple zwar gelesen, dass Spotlight immer nur ein Plugin für einen Dateityp verwendet, hatte aber daraufhin den PDF.mdimporter in ein anderes Verzeichnis verschoben. Trotz erneuter Registrierung meines Plugins (mit mdimport -r) verwendet Spotlight es nicht für PDFs (Befehl zur Abfrage ist mir grad entfallen). Außerdem lisstet er unter mdimport -X (Schema-Abfrage) neben meinen Metadaten die ursprünglichen Metadaten für PDF an der Stelle auf, wo die Deklaration der meiner Metadaten stehen sollte, die in Dialogen, wie Datei-Information (im Finder) angezeigt werden sollten.

Gruß
Mathias
 
Fortschritte bei XMP-Plugin?

Hallo Mathias,

gibt's denn Fortschritte mit Deinem Spotlight-Plugin für XMP-Daten?

Ich verwende den GraphicConverter, um Ratings für ein Bild nicht in einer Datenbank sondern direkt am Bild via XMP abzulegen.

Ich kann's kaum glauben, dass weder Adobe noch Apple (Aperture unterstützt auch streckenweise XMP!) bis heute ein entsprechendes Plugin geschrieben haben.

Je nach Umfang der XMP-Unterstützung hätte ein solches Plugin auch gute Chancen als kommerzielle Software.
 
Zurück
Oben Unten