[rygel] server: Fix use of DLNA.ORG_AnyContainer
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Fix use of DLNA.ORG_AnyContainer
- Date: Tue, 29 Jan 2013 11:13:27 +0000 (UTC)
commit c6364a71235c0e7945a5d7256dd4bfd67340b0e0
Author: Jens Georg <jensg openismus com>
Date: Tue Jan 29 11:58:58 2013 +0100
server: Fix use of DLNA.ORG_AnyContainer
src/librygel-server/rygel-item-creator.vala | 8 ++++----
src/librygel-server/rygel-media-container.vala | 2 ++
tests/rygel-item-creator-test.vala | 1 +
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/librygel-server/rygel-item-creator.vala b/src/librygel-server/rygel-item-creator.vala
index 69e4d5b..e33b6e7 100644
--- a/src/librygel-server/rygel-item-creator.vala
+++ b/src/librygel-server/rygel-item-creator.vala
@@ -72,12 +72,12 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
/* Verify the create class. Note that we always assume
* createClass includeDerived to be false.
*
- * DLNA_ORG.AnyContainer is a special case. We are allowed to
+ * DLNA.ORG_AnyContainer is a special case. We are allowed to
* modify the UPnP class to something we support and
* fetch_container took care of this already.
*/
if (!container.can_create (this.didl_item.upnp_class) &&
- this.container_id != "DLNA_ORG.AnyContainer") {
+ this.container_id != MediaContainer.ANY) {
throw new ContentDirectoryError.BAD_METADATA
("Creating of objects with class %s " +
"is not supported in %s",
@@ -95,7 +95,7 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
// Conclude the successful action
this.conclude ();
- if (this.container_id == "DLNA.ORG_AnyContainer" &&
+ if (this.container_id == MediaContainer.ANY &&
this.item.place_holder) {
var queue = ItemRemovalQueue.get_default ();
@@ -269,7 +269,7 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
private async WritableContainer fetch_container () throws Error {
MediaObject media_object = null;
- if (this.container_id == "DLNA.ORG_AnyContainer") {
+ if (this.container_id == MediaContainer.ANY) {
media_object = yield this.find_any_container ();
} else {
media_object = yield this.content_dir.root_container.find_object
diff --git a/src/librygel-server/rygel-media-container.vala b/src/librygel-server/rygel-media-container.vala
index 711f759..bee84fb 100644
--- a/src/librygel-server/rygel-media-container.vala
+++ b/src/librygel-server/rygel-media-container.vala
@@ -45,6 +45,8 @@ public enum Rygel.ObjectEventType {
* REALNAME, in in the title. See the title property of the #RygelMediaObject.
*/
public abstract class Rygel.MediaContainer : MediaObject {
+ // Magic ID used by DLNA to denote any container that can create the item
+ public const string ANY = "DLNA.ORG_AnyContainer";
public const string UPNP_CLASS = "object.container";
public const string STORAGE_FOLDER = UPNP_CLASS + ".storageFolder";
public const string MUSIC_ALBUM = UPNP_CLASS + ".album.musicAlbum";
diff --git a/tests/rygel-item-creator-test.vala b/tests/rygel-item-creator-test.vala
index 63cb8e2..019d137 100644
--- a/tests/rygel-item-creator-test.vala
+++ b/tests/rygel-item-creator-test.vala
@@ -204,6 +204,7 @@ public class Rygel.MediaContainer : Rygel.MediaObject {
public Gee.ArrayList<string> create_classes = new Gee.ArrayList<string> ();
public int child_count;
public string sort_criteria = "+dc:title";
+ public static const string ANY = "DLNA.ORG_AnyContainer";
public uint update_id;
// mockable elements
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]