aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/media/media-api.c
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2016-01-20 16:31:00 +0100
committerManuel Bachmann <manuel.bachmann@iot.bzh>2016-01-20 16:31:00 +0100
commit9c066241bc2c1195f1bee5c17b39b023d257bd9e (patch)
tree3f689153cd1cebfbf013d1966a31ed8b2c428a8f /plugins/media/media-api.c
parenta5a5383bba11e69379e27919f101c5e7718f8bf2 (diff)
Fix Media Plugin content list API
Listing content had various pointer-related issues. Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'plugins/media/media-api.c')
-rw-r--r--plugins/media/media-api.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/media/media-api.c b/plugins/media/media-api.c
index 60228a07..4365862a 100644
--- a/plugins/media/media-api.c
+++ b/plugins/media/media-api.c
@@ -57,11 +57,17 @@ STATIC json_object* init (AFB_request *request) { /* AFB_SESSION_CHECK */
STATIC json_object* list (AFB_request *request) { /* AFB_SESSION_CHECK */
+ json_object *jresp;
char *result;
result = _rygel_list (request->context);
- return jsonNewMessage(AFB_SUCCESS, result);
+ if (!result)
+ return jsonNewMessage(AFB_FAIL, "No content found in media server");
+
+ jresp = json_object_new_object();
+ json_object_object_add(jresp, "list", json_object_new_string (result));
+ return jresp;
}
STATIC json_object* ping (AFB_request *request) { /* AFB_SESSION_NONE */