From: Jens Georg Date: Tue, 25 Oct 2011 08:06:53 +0000 (+0200) Subject: tracker: Let the miner decide the RDF type X-Git-Tag: RYGEL_0_13_0~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=193aff3bd259a1437ee1d243d0dcc49dae645ac2;p=profile%2Fivi%2Frygel.git tracker: Let the miner decide the RDF type We only set the generic RDF type nfo:Media to prevent situations where a client uploads e.g. an image with DIDL meta-data for an MP3. Previously the item would then be a nmm:Music (from CreateItem) and nmm:Photo (from the miner). --- diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala b/src/plugins/tracker/rygel-tracker-insertion-query.vala index 62fae0d..05c1e1a 100644 --- a/src/plugins/tracker/rygel-tracker-insertion-query.vala +++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala @@ -60,7 +60,7 @@ public class Rygel.Tracker.InsertionQuery : Query { } var triplets = new QueryTriplets (); - triplets.add (new QueryTriplet (QUERY_ID, "a", category)); + triplets.add (new QueryTriplet (QUERY_ID, "a", "nfo:Media")); triplets.add (new QueryTriplet (QUERY_ID, "a", type)); triplets.add (new QueryTriplet (QUERY_ID, "nmm:uPnPShared", "true")); triplets.add (new QueryTriplet (QUERY_ID, "tracker:available", "true")); diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala index c3762d9..40f5f36 100644 --- a/src/plugins/tracker/rygel-tracker-search-container.vala +++ b/src/plugins/tracker/rygel-tracker-search-container.vala @@ -116,13 +116,16 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer { uint offset, uint max_count, out uint total_matches, - Cancellable? cancellable) + Cancellable? cancellable, + bool generic_type = false) throws GLib.Error { var results = new MediaObjects (); var query = this.create_query (expression as RelationalExpression, (int) offset, - (int) max_count); + (int) max_count, + generic_type); + if (query != null) { yield query.execute (this.resources); @@ -159,7 +162,8 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer { 0, 1, out total_matches, - cancellable); + cancellable, + true); if (results.size > 0) { return results[0]; } else { @@ -216,7 +220,8 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer { private SelectionQuery? create_query (RelationalExpression? expression, int offset, - int max_count) { + int max_count, + bool generic_type) { if (expression.operand1 == "upnp:class" && !this.item_factory.upnp_class.has_prefix (expression.operand2)) { return null; @@ -237,6 +242,16 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer { } } + // Drop to generic RDF type for find_object + if (generic_type) { + foreach (var triplet in query.triplets) { + if (triplet.predicate == "a" && + triplet.obj.has_prefix ("nmm:")) { + triplet.obj = "nfo:Media"; + } + } + } + query.offset = offset; query.max_count = max_count;