summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-01-04 13:17:07 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-01-04 13:17:38 -0800
commitdc2a75cb3780a136be51dd2f880f70083ba36733 (patch)
treeecfdbbd50cc3079821b0e118794a1385a81fb0c5
parentd03590991d2c7104e7cd4b2a18e710008b2759ab (diff)
binding: mediaplayer: only get audio resultseel_5.0.1eel/5.0.15.0.1
Since video playback doesn't work yet don't populate the playlist with video media entries. Bug-AGL: SPEC-1236 Change-Id: I3b161351d975442e512bdbf2215174be2301069d Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding/afm-common.h1
-rw-r--r--binding/afm-mediaplayer-binding.c16
2 files changed, 15 insertions, 2 deletions
diff --git a/binding/afm-common.h b/binding/afm-common.h
index 302dd26..34258da 100644
--- a/binding/afm-common.h
+++ b/binding/afm-common.h
@@ -35,6 +35,7 @@ struct playlist_item {
gchar *genre;
gint64 duration;
gchar *media_path;
+ gchar *media_type;
};
enum {
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 478ba0e..b344917 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -105,6 +105,14 @@ static gboolean populate_from_json(struct playlist_item *item, json_object *jdic
return ret;
item->media_path = g_strdup(json_object_get_string(val));
+ ret = json_object_object_get_ex(jdict, "type", &val);
+ if (!ret) {
+ g_object_unref(item->media_path);
+ return ret;
+ }
+ item->media_type = g_strdup(json_object_get_string(val));
+
+
ret = json_object_object_get_ex(jdict, "title", &val);
if (ret) {
item->title = g_strdup(json_object_get_string(val));
@@ -199,8 +207,12 @@ static json_object *populate_json_playlist(json_object *jresp)
json_object *jarray = json_object_new_array();
for (l = playlist; l; l = l->next) {
- json_object *item = populate_json(l->data);
- json_object_array_add(jarray, item);
+ struct playlist_item *track = l->data;
+
+ if (track && !g_strcmp0(track->media_type, "audio")) {
+ json_object *item = populate_json(track);
+ json_object_array_add(jarray, item);
+ }
}
json_object_object_add(jresp, "list", jarray);