[rygel] tracker,data: Add strict/relaxed sharing



commit b2163566070799a5451e359a26986b68509ee22f
Author: Jens Georg <mail jensge org>
Date:   Fri Jul 8 23:11:16 2011 +0200

    tracker,data: Add strict/relaxed sharing
    
    Relaxed sharing: Share any file that has nmm:uPnPShared true.
    Strict sharing: Share any file that has nmm:uPnPShared true and a valid
                    nmm:dlnaProfile.

 data/rygel.conf                                    |    1 +
 .../tracker/rygel-tracker-selection-query.vala     |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/data/rygel.conf b/data/rygel.conf
index 42614d7..91fa862 100644
--- a/data/rygel.conf
+++ b/data/rygel.conf
@@ -83,6 +83,7 @@ enabled=true
 share-pictures=true
 share-videos=true
 share-music=true
+strict-sharing=false
 title= REALNAME@'s media
 
 [MediaExport]
diff --git a/src/plugins/tracker/rygel-tracker-selection-query.vala b/src/plugins/tracker/rygel-tracker-selection-query.vala
index a037ada..ca55a6c 100644
--- a/src/plugins/tracker/rygel-tracker-selection-query.vala
+++ b/src/plugins/tracker/rygel-tracker-selection-query.vala
@@ -32,6 +32,8 @@ public class Rygel.Tracker.SelectionQuery : Query {
                                          " nmm:uPnPShared(" +
                                          ITEM_VARIABLE +
                                          ") = true)";
+    private const string STRICT_SHARED_FILTER = "(BOUND(nmm:dlnaProfile(" +
+                                                ITEM_VARIABLE + ")))";
     private const string AVAILABLE_FILTER = "(tracker:available(" +
                                             ITEM_VARIABLE + ") = true)";
 
@@ -100,6 +102,14 @@ public class Rygel.Tracker.SelectionQuery : Query {
         // mounted
         filters.add (AVAILABLE_FILTER);
 
+        // If strict sharing is enabled, only expose files that have a DLNA
+        // profile set
+        try {
+            if (config.get_bool ("Tracker", "strict-sharing")) {
+                filters.add (STRICT_SHARED_FILTER);
+            }
+        } catch (Error error) {};
+
         if (filters.size > 0) {
             query += " FILTER (";
             for (var i = 0; i < filters.size; i++) {



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