[rygel] tracker3: Restrict queries to graphs
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker3: Restrict queries to graphs
- Date: Sun, 5 Jul 2020 13:38:25 +0000 (UTC)
commit 99e23e2cb62100d024f7f5f648707403cb15fc13
Author: Jens Georg <mail jensge org>
Date: Mon Jun 1 13:30:39 2020 +0200
tracker3: Restrict queries to graphs
src/plugins/tracker3/rygel-tracker-item-factory.vala | 3 +++
src/plugins/tracker3/rygel-tracker-metadata-multivalues.vala | 2 +-
src/plugins/tracker3/rygel-tracker-metadata-values.vala | 6 +++++-
src/plugins/tracker3/rygel-tracker-music-item-factory.vala | 3 ++-
src/plugins/tracker3/rygel-tracker-picture-item-factory.vala | 3 ++-
src/plugins/tracker3/rygel-tracker-search-container.vala | 2 ++
src/plugins/tracker3/rygel-tracker-selection-query.vala | 5 +++++
src/plugins/tracker3/rygel-tracker-video-item-factory.vala | 3 ++-
8 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/tracker3/rygel-tracker-item-factory.vala
b/src/plugins/tracker3/rygel-tracker-item-factory.vala
index 5c069f80..53c29e8d 100644
--- a/src/plugins/tracker3/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker3/rygel-tracker-item-factory.vala
@@ -51,6 +51,7 @@ public abstract class Rygel.Tracker.ItemFactory {
public string category;
public string category_iri;
+ public string graph;
public string upnp_class;
public string? upload_dir;
@@ -58,10 +59,12 @@ public abstract class Rygel.Tracker.ItemFactory {
protected ItemFactory (string category,
string category_iri,
+ string graph,
string upnp_class,
string? upload_dir) {
this.category = category;
this.category_iri = category_iri;
+ this.graph = graph;
this.upnp_class = upnp_class;
this.upload_dir = upload_dir;
diff --git a/src/plugins/tracker3/rygel-tracker-metadata-multivalues.vala
b/src/plugins/tracker3/rygel-tracker-metadata-multivalues.vala
index a5d94716..0298c755 100644
--- a/src/plugins/tracker3/rygel-tracker-metadata-multivalues.vala
+++ b/src/plugins/tracker3/rygel-tracker-metadata-multivalues.vala
@@ -78,7 +78,7 @@ public abstract class Rygel.Tracker.MetadataMultiValues : MetadataContainer {
var last_variable = variables[num_keys - 1];
selected.add ("DISTINCT " + last_variable);
- return new SelectionQuery (selected, triplets, null, last_variable);
+ return new SelectionQuery (selected, triplets, null, this.item_factory.graph, last_variable);
}
protected override SearchContainer create_container (string id,
diff --git a/src/plugins/tracker3/rygel-tracker-metadata-values.vala
b/src/plugins/tracker3/rygel-tracker-metadata-values.vala
index 1c443df7..8bebb3cf 100644
--- a/src/plugins/tracker3/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker3/rygel-tracker-metadata-values.vala
@@ -61,7 +61,11 @@ public abstract class Rygel.Tracker.MetadataValues : MetadataContainer {
property_map[this.property] +
" AS ?x");
- var q = new SelectionQuery (selected, triplets, null, "?x");
+ var q = new SelectionQuery (selected,
+ triplets,
+ null,
+ this.item_factory.graph,
+ "?x");
critical(q.to_string());
return q;
}
diff --git a/src/plugins/tracker3/rygel-tracker-music-item-factory.vala
b/src/plugins/tracker3/rygel-tracker-music-item-factory.vala
index 9a273999..6eca80e9 100644
--- a/src/plugins/tracker3/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker3/rygel-tracker-music-item-factory.vala
@@ -46,6 +46,7 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
}
private const string CATEGORY = "nmm:MusicPiece";
+ private const string GRAPH = "tracker:Audio";
private const string CATEGORY_IRI = "http://www.tracker-project.org/" +
"temp/nmm#MusicPiece";
@@ -57,7 +58,7 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
upload_folder = config.get_music_upload_folder ();
} catch (Error error) {};
- base (CATEGORY, CATEGORY_IRI, MusicItem.UPNP_CLASS, upload_folder);
+ base (CATEGORY, CATEGORY_IRI, GRAPH, MusicItem.UPNP_CLASS, upload_folder);
// These must be the same order as enum MusicMetadata
this.properties.add ("res@duration");
diff --git a/src/plugins/tracker3/rygel-tracker-picture-item-factory.vala
b/src/plugins/tracker3/rygel-tracker-picture-item-factory.vala
index e937fc2d..d50b8dc8 100644
--- a/src/plugins/tracker3/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker3/rygel-tracker-picture-item-factory.vala
@@ -40,6 +40,7 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
private const string CATEGORY = "nmm:Photo";
private const string CATEGORY_IRI = "http://www.tracker-project.org/" +
"temp/nmm#Photo";
+ private const string GRAPH = "tracker:Pictures";
public PictureItemFactory () {
var upload_folder = Environment.get_user_special_dir
@@ -49,7 +50,7 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
upload_folder = config.get_picture_upload_folder ();
} catch (Error error) {};
- base (CATEGORY, CATEGORY_IRI, PhotoItem.UPNP_CLASS, upload_folder);
+ base (CATEGORY, CATEGORY_IRI, GRAPH, PhotoItem.UPNP_CLASS, upload_folder);
// These must be in the same order as enum PictureMetadata
this.properties.add ("height");
diff --git a/src/plugins/tracker3/rygel-tracker-search-container.vala
b/src/plugins/tracker3/rygel-tracker-search-container.vala
index 965d8294..bf66d2dc 100644
--- a/src/plugins/tracker3/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker3/rygel-tracker-search-container.vala
@@ -96,6 +96,7 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer {
this.query = new SelectionQuery (variables,
our_triplets,
filters,
+ this.item_factory.graph,
order_by);
this.get_children_count.begin ();
@@ -305,6 +306,7 @@ public class Rygel.Tracker.SearchContainer : SimpleContainer {
variables,
new QueryTriplets.clone(this.query.triplets),
filters,
+ this.item_factory.graph,
order);
}
diff --git a/src/plugins/tracker3/rygel-tracker-selection-query.vala
b/src/plugins/tracker3/rygel-tracker-selection-query.vala
index 7fd9c580..b86d6627 100644
--- a/src/plugins/tracker3/rygel-tracker-selection-query.vala
+++ b/src/plugins/tracker3/rygel-tracker-selection-query.vala
@@ -47,6 +47,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
public ArrayList<string> variables;
public ArrayList<string> filters;
+ public string graph;
public string order_by;
public int offset;
@@ -57,6 +58,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
public SelectionQuery (ArrayList<string> variables,
QueryTriplets triplets,
ArrayList<string>? filters,
+ string graph,
string? order_by = null,
int offset = 0,
int max_count = -1) {
@@ -69,6 +71,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
}
this.variables = variables;
+ this.graph = graph;
this.order_by = order_by;
this.offset = offset;
this.max_count = max_count;
@@ -135,6 +138,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
this (copy_str_list (query.variables),
new QueryTriplets.clone (query.triplets),
copy_str_list (query.filters),
+ query.graph,
query.order_by,
query.offset,
query.max_count);
@@ -159,6 +163,7 @@ public class Rygel.Tracker.SelectionQuery : Query {
query += " " + variable;
}
+ query += " FROM tracker:FileSystem FROM %s".printf(this.graph);
query += " WHERE { " + base.to_string ();
var filters = new ArrayList<string> ();
diff --git a/src/plugins/tracker3/rygel-tracker-video-item-factory.vala
b/src/plugins/tracker3/rygel-tracker-video-item-factory.vala
index 07aac77b..bed04c71 100644
--- a/src/plugins/tracker3/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker3/rygel-tracker-video-item-factory.vala
@@ -42,6 +42,7 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
private const string CATEGORY = "nmm:Video";
private const string CATEGORY_IRI = "http://www.tracker-project.org/" +
"temp/nmm#Video";
+ private const string GRAPH = "tracker:Videos";
public VideoItemFactory () {
var upload_folder = Environment.get_user_special_dir
@@ -51,7 +52,7 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
upload_folder = config.get_video_upload_folder ();
} catch (Error error) {};
- base (CATEGORY, CATEGORY_IRI, VideoItem.UPNP_CLASS, upload_folder);
+ base (CATEGORY, CATEGORY_IRI, GRAPH, VideoItem.UPNP_CLASS, upload_folder);
// These must be in the same order as enum VideoMetadata
this.properties.add ("height");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]