Hi guys, I have finished my feature that allows MTP daemons to through an API get a correct SPARQL INSERT query with extracted metadata for a file.
This is the branch: extract-sparql http://git.gnome.org/browse/tracker/log/?h=extract-sparql This is the currently only commit: http://git.gnome.org/browse/tracker/commit/?h=extract-sparql&id=e4af9b34e22b60d37251426a29dfcd9b566f6e0e This is the newly added API: static void on_finished (GObject *none, GAsyncResult *result, gpointer user_data) { GMainLoop *loop = user_data; GError *error = NULL; gchar *sparql = tracker_extract_get_sparql_finish (result, &error); if (error == NULL) { g_print ("%s", sparql); g_free (sparql); } else { g_error("%s", error->message); } g_clear_error (&error); g_main_loop_quit (loop); } int main (int argc, char **argv) { const gchar *file = "/tmp/file.png"; const gchar *dest = "file:///tmp/destination.png" GMainLoop *loop; g_type_init(); loop = g_main_loop_new (NULL, FALSE); tracker_extract_get_sparql (file, dest, NULL, time(0), time(0), on_finished, loop); g_main_loop_run (loop); g_object_unref (loop); return 0; } I have also added usage of the API to the tracker-sparql binary: $ cp /home/pvanhoof/Documents/Photos/pasfoto-small.png /tmp/tempfile.png $ /opt/tracker/bin/tracker-sparql --metadata-file-path=/tmp/tempfile.png \ --metadata-graph-urn=urn:uuid:173b2520-4828-11e2-bcfd-0800200c9a66 \ --metadata-dest-url=file:///home/pvanhoof/Documents/Photos/photo.png INSERT SILENT { GRAPH <urn:uuid:173b2520-4828-11e2-bcfd-0800200c9a66> { _:file a nfo:FileDataObject , nie:InformationElement ; nfo:fileName "photo.png" ; nfo:fileSize 38155 ; nfo:fileLastModified "2012-12-17T09:20:18Z" ; nfo:fileLastAccessed "2012-12-17T09:20:18Z" ; nie:isStoredAs _:file ; nie:url "file:///home/pvanhoof/Documents/Photos/photo.png" ; nie:mimeType "image/png" ; a nfo:FileDataObject ; nie:dataSource <urn:nepomuk:datasource:9291a450-1d49-11de-8c30-0800200c9a66> ; tracker:available true . _:file a nfo:Image , nmm:Photo ; nfo:width 150 ; nfo:height 192 ; nmm:dlnaProfile "PNG_LRG" ; nmm:dlnaMime "image/png" . } } $ Please review. Kind regards, Philip -- Philip Van Hoof Software developer Codeminded BVBA - http://codeminded.be _______________________________________________ tracker-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/tracker-list
