[rygel/wip/tracker-3.0] WIP



commit 14de2c0ad8841d950155dbbdca2f01b8997dbe82
Author: Jens Georg <mail jensge org>
Date:   Sun Jun 7 18:09:52 2020 +0200

    WIP

 .../tracker3/rygel-tracker-insertion-query.vala      | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/tracker3/rygel-tracker-insertion-query.vala 
b/src/plugins/tracker3/rygel-tracker-insertion-query.vala
index ef21d83f..f6697977 100644
--- a/src/plugins/tracker3/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker3/rygel-tracker-insertion-query.vala
@@ -31,16 +31,16 @@ public class Rygel.Tracker.InsertionQuery : Query {
     private const string TEMP_ID = "x";
     private const string QUERY_ID = "_:" + TEMP_ID;
 
-    private const string MINER_SERVICE = "org.freedesktop.Tracker1.Miner.Files.Index";
-    private const string MINER_PATH = "/org/freedesktop/Tracker1/Miner/Files/Index";
+    private const string MINER_SERVICE = "org.freedesktop.Tracker3.Miner.Files.Index";
+    private const string MINER_PATH = "/org/freedesktop/Tracker3/Miner/Files/Index";
 
     private const string MINER_GRAPH = "tracker:FileSystem";
 
     private const string RESOURCE_ID_QUERY_TEMPLATE =
-        "SELECT ?resource WHERE { ?resource a nie:DataObject; nie:url '%s' }";
+        "SELECT ?resource WHERE { ?f a nie:DataObject; nie:url '%s'; nie:interpretedAs ?resource }";
 
     private const string RESOURCE_NOT_BOUND_TEMPLATE =
-        "OPTIONAL { ?resource a nie:DataObject; nie:url '%s' } " +
+        "OPTIONAL { GRAPH Tracker:FileSystem { ?resource a nie:DataObject; nie:url '%s' }} " +
         "FILTER (!bound(?resource))";
 
     public string id;
@@ -82,8 +82,8 @@ public class Rygel.Tracker.InsertionQuery : Query {
                                                 QUERY_ID,
                                                 "nie:mimeType",
                                                 "\"" + item.mime_type + "\""));
-
-
+    
+    
         triplets.add (new QueryTriplet.with_graph ("Tracker:Audio", QUERY_ID,
                                                    "nie:isStoredAs", urn));
         string date;
@@ -128,6 +128,8 @@ public class Rygel.Tracker.InsertionQuery : Query {
         VariantIter iter1, iter2, iter3;
         string key = null;
 
+        debug("Result: %s", v.print(true));
+
         iter1 = v.iterator ();
         while (iter1.next ("aa{ss}", out iter2)) {
             while (iter2.next ("a{ss}", out iter3)) {
@@ -139,6 +141,7 @@ public class Rygel.Tracker.InsertionQuery : Query {
 
         // Item already existed
         if (this.id == null)  {
+            debug("Item already exists, running query %s", this.get_resource_id_query ().to_string ());
             var cursor = yield resources.query_async
                                         (this.get_resource_id_query ());
 
@@ -148,6 +151,7 @@ public class Rygel.Tracker.InsertionQuery : Query {
                     break;
                 }
             } catch (Error error) {
+                debug ("Failed to query resource: %s", error.message);
             }
             cursor.close ();
         } else {
@@ -168,8 +172,8 @@ public class Rygel.Tracker.InsertionQuery : Query {
 
     public override string to_string () {
         var query = "INSERT { " + base.to_string () + " }";
-        query += "WHERE {" + RESOURCE_NOT_BOUND_TEMPLATE.printf (this.uri) +
-                 "}";
+        //  query += "WHERE {" + RESOURCE_NOT_BOUND_TEMPLATE.printf (this.uri) +
+        //             "}";
 
         return query;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]