]> arthur.barton.de Git - netatalk.git/blobdiff - etc/spotlight/slmod_sparql.c
Spotlight: use async Tracker SPARQL API
[netatalk.git] / etc / spotlight / slmod_sparql.c
index 11b1dacf53449274b3eaea215f8105bc1745ff4c..e58d7df68518e657b058566b3cb36d132a8e080b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2012 Frank Lahm <franklahm@gmail.com>
+  Copyright (C) Ralph Boehme 2012-2014
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -34,7 +34,6 @@
 #define MAX_SL_RESULTS 20
 
 static TrackerSparqlConnection *connection;
-static TrackerMinerManager *manager;
 
 static char *tracker_to_unix_path(const char *uri)
 {
@@ -57,7 +56,8 @@ static int sl_mod_init(void *p)
 {
     EC_INIT;
     GError *error = NULL;
-    const char *msg = p;
+    AFPObj *obj = (AFPObj *)p;
+    const char *attributes;
 
     LOG(log_info, logtype_sl, "Initializing Spotlight module");
 
@@ -73,7 +73,9 @@ static int sl_mod_init(void *p)
 
     become_root();
     connection = tracker_sparql_connection_get(NULL, &error);
+#if 0 /* this may hang, so disable it as we don't use the miner anyway  */
     manager = tracker_miner_manager_new_full(FALSE, &error);
+#endif
     unbecome_root();
 
     if (!connection) {
@@ -83,11 +85,18 @@ static int sl_mod_init(void *p)
         EC_FAIL;
     }
 
+#if 0
     if (!manager) {
         LOG(log_error, logtype_sl, "Couldn't connect to Tracker miner");
         g_clear_error(&error);
         EC_FAIL;
     }
+#endif
+
+    attributes = atalk_iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "spotlight attributes", NULL);
+    if (attributes) {
+        configure_spotlight_attributes(attributes);
+    }
 
 EC_CLEANUP:
     EC_EXIT;
@@ -386,35 +395,6 @@ static int sl_mod_index_file(const void *p)
      * impose limits on the maximum number of watched directories.
      */
     return 0;
-
-#ifdef HAVE_TRACKER_MINER
-    EC_INIT;
-    const char *f = p;
-
-    if (!f)
-        goto EC_CLEANUP;
-
-    GError *error = NULL;
-    GFile *file = NULL;
-
-    file = g_file_new_for_commandline_arg(f);
-
-    become_root();
-    tracker_miner_manager_index_file(manager, file, &error);
-    unbecome_root();
-
-    if (error)
-        LOG(log_error, logtype_sl, "sl_mod_index_file(\"%s\"): indexing failed", f);
-    else
-        LOG(log_debug, logtype_sl, "sl_mod_index_file(\"%s\"): indexing file was successful", f);
-
-EC_CLEANUP:
-    if (file)
-        g_object_unref(file);
-    EC_EXIT;
-#else
-    return 0;
-#endif
 }
 
 struct sl_module_export sl_mod = {