[rygel] core,tracker,media-export: Advertize search classes
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core,tracker,media-export: Advertize search classes
- Date: Fri, 17 Jun 2011 13:14:39 +0000 (UTC)
commit 363606bebc089485918b5683d1477c74a7b48eea
Author: Topi Santakivi <topi santakivi digia com>
Date: Thu May 26 12:27:16 2011 +0300
core,tracker,media-export: Advertize search classes
SearchableContainer implementations now report supported search classes.
That information is then relayed to clients.
This satisfies DLNA requirement 7.3.67.4.
Co-author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
src/plugins/external/rygel-external-container.vala | 2 ++
.../rygel-media-export-db-container.vala | 2 ++
.../rygel-tracker-category-all-container.vala | 2 ++
src/plugins/tracker/rygel-tracker-music.vala | 2 ++
src/plugins/tracker/rygel-tracker-pictures.vala | 1 +
src/plugins/tracker/rygel-tracker-videos.vala | 1 +
src/rygel/rygel-media-container.vala | 4 ++++
src/rygel/rygel-searchable-container.vala | 10 ++++++++++
src/rygel/rygel-simple-container.vala | 8 ++++++++
9 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index 95d8707..2df9f0c 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -37,6 +37,7 @@ public class Rygel.External.Container : Rygel.MediaContainer,
private ItemFactory item_factory;
private ArrayList<Container> containers;
+ public ArrayList<string> search_classes { get; set; }
private bool searchable;
@@ -52,6 +53,7 @@ public class Rygel.External.Container : Rygel.MediaContainer,
this.service_name = service_name;
this.item_factory = new ItemFactory ();
this.containers = new ArrayList<Container> ();
+ this.search_classes = new ArrayList<string> ();
// Create proxy to MediaContainer iface
this.actual_container = Bus.get_proxy_sync
diff --git a/src/plugins/media-export/rygel-media-export-db-container.vala b/src/plugins/media-export/rygel-media-export-db-container.vala
index 5935186..03e18db 100644
--- a/src/plugins/media-export/rygel-media-export-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-db-container.vala
@@ -25,11 +25,13 @@ using Gee;
public class Rygel.MediaExport.DBContainer : MediaContainer,
SearchableContainer {
protected MediaCache media_db;
+ public ArrayList<string> search_classes { get; set; }
public DBContainer (MediaCache media_db, string id, string title) {
base (id, null, title, 0);
this.media_db = media_db;
+ this.search_classes = new ArrayList<string> ();
this.container_updated.connect (on_db_container_updated);
this.on_db_container_updated (this, this);
}
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index dab7983..d848939 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -35,6 +35,7 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
private const string RESOURCES_PATH = "/org/freedesktop/Tracker1/Resources";
public ArrayList<string> create_classes { get; set; }
+ public ArrayList<string> search_classes { get; set; }
private ResourcesIface resources;
@@ -43,6 +44,7 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
this.create_classes = new ArrayList<string> ();
this.create_classes.add (item_factory.upnp_class);
+ this.search_classes = new ArrayList<string> ();
try {
this.resources = Bus.get_proxy_sync
diff --git a/src/plugins/tracker/rygel-tracker-music.vala b/src/plugins/tracker/rygel-tracker-music.vala
index 142add6..5551eab 100644
--- a/src/plugins/tracker/rygel-tracker-music.vala
+++ b/src/plugins/tracker/rygel-tracker-music.vala
@@ -33,6 +33,8 @@ public class Rygel.Tracker.Music : CategoryContainer {
this.add_child_container (new Artists (this));
this.add_child_container (new Albums (this));
this.add_child_container (new Genre (this));
+ this.search_classes.add (AudioItem.UPNP_CLASS);
+ this.search_classes.add (MusicItem.UPNP_CLASS);
}
}
diff --git a/src/plugins/tracker/rygel-tracker-pictures.vala b/src/plugins/tracker/rygel-tracker-pictures.vala
index eac5344..64fef47 100644
--- a/src/plugins/tracker/rygel-tracker-pictures.vala
+++ b/src/plugins/tracker/rygel-tracker-pictures.vala
@@ -31,6 +31,7 @@ public class Rygel.Tracker.Pictures : CategoryContainer {
base (id, parent, title, new PictureItemFactory ());
this.add_child_container (new Years (this, this.item_factory));
+ this.search_classes.add (ImageItem.UPNP_CLASS);
}
}
diff --git a/src/plugins/tracker/rygel-tracker-videos.vala b/src/plugins/tracker/rygel-tracker-videos.vala
index 3a69bb5..b23d8db 100644
--- a/src/plugins/tracker/rygel-tracker-videos.vala
+++ b/src/plugins/tracker/rygel-tracker-videos.vala
@@ -31,6 +31,7 @@ public class Rygel.Tracker.Videos : CategoryContainer {
base (id, parent, title, new VideoItemFactory ());
this.add_child_container (new Years (this, this.item_factory));
+ this.search_classes.add (VideoItem.UPNP_CLASS);
}
}
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index f6fab05..2e16a54 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -149,6 +149,10 @@ public abstract class Rygel.MediaContainer : MediaObject {
didl_container.parent_id = this.parent.id;
} else {
didl_container.parent_id = "-1";
+ if (this is SearchableContainer) {
+ (this as SearchableContainer).serialize_search_parameters
+ (didl_container);
+ }
}
didl_container.id = this.id;
diff --git a/src/rygel/rygel-searchable-container.vala b/src/rygel/rygel-searchable-container.vala
index d719ea9..10f9713 100644
--- a/src/rygel/rygel-searchable-container.vala
+++ b/src/rygel/rygel-searchable-container.vala
@@ -24,8 +24,11 @@
*/
using GUPnP;
+using Gee;
public interface Rygel.SearchableContainer : MediaContainer {
+ public abstract ArrayList<string> search_classes { get; set; }
+
/**
* Recursively searches for all media objects that satisfy the given search
* expression in this container.
@@ -191,4 +194,11 @@ public interface Rygel.SearchableContainer : MediaContainer {
return result;
}
+
+ internal void serialize_search_parameters
+ (DIDLLiteContainer didl_container) {
+ foreach (var search_class in this.search_classes) {
+ didl_container.add_search_class (search_class);
+ }
+ }
}
diff --git a/src/rygel/rygel-simple-container.vala b/src/rygel/rygel-simple-container.vala
index 55dd96b..81f40af 100644
--- a/src/rygel/rygel-simple-container.vala
+++ b/src/rygel/rygel-simple-container.vala
@@ -35,6 +35,8 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
private MediaObjects empty_children;
+ public ArrayList<string> search_classes { get; set; }
+
public SimpleContainer (string id,
MediaContainer? parent,
string title) {
@@ -42,6 +44,7 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
this.children = new MediaObjects ();
this.empty_children = new MediaObjects ();
+ this.search_classes = new ArrayList<string> ();
}
public SimpleContainer.root (string title) {
@@ -57,6 +60,11 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
* until it has any children to offer.
*/
public void add_child_container (MediaContainer child) {
+ if (child is SearchableContainer) {
+ var search_classes = (child as SearchableContainer).search_classes;
+ this.search_classes.add_all (search_classes);
+ }
+
if (child.child_count > 0) {
this.add_child (child);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]