[rygel] core: Implement DLNA's AnyContainer upload
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Implement DLNA's AnyContainer upload
- Date: Wed, 23 Jun 2010 13:45:04 +0000 (UTC)
commit 5ac4957e6de68354bb995ec62feedd318fd6cdcb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Jun 21 20:21:53 2010 +0300
core: Implement DLNA's AnyContainer upload
Implement DLNA feature that allows clients to upload items without having
to specify which container they should be put into.
src/rygel/rygel-item-creator.vala | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index dd76295..a116383 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -109,9 +109,32 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
}
private async MediaContainer fetch_container () throws Error {
- var media_object = yield this.content_dir.root_container.find_object (
+ MediaObject media_object = null;
+
+ if (this.container_id == "DLNA.ORG_AnyContainer") {
+ var expression = new RelationalExpression ();
+ expression.op = SearchCriteriaOp.DERIVED_FROM;
+ expression.operand1 = "upnp:createClass";
+ expression.operand2 = didl_item.upnp_class;
+
+ uint total_matches;
+
+ var result = yield this.content_dir.root_container.search (
+ expression,
+ 0,
+ 1,
+ out total_matches,
+ this.cancellable);
+ if (result.size > 0) {
+ media_object = result[0];
+ this.container_id = media_object.id;
+ }
+ } else {
+ media_object = yield this.content_dir.root_container.find_object (
this.container_id,
this.cancellable);
+ }
+
if (media_object == null || !(media_object is MediaContainer)) {
throw new ContentDirectoryError.NO_SUCH_OBJECT (
_("No such object"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]