summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-05-14 14:57:20 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2018-05-14 14:57:20 +0000
commit10603589e76fa39147544aa9eb90cab424df1ea9 (patch)
tree723b27ac42df43fee56104755e9750858a7ff621
parent65d717b400a17e3a380126657ebaa080f1877e47 (diff)
parent6fbd3e296843993e487af446642e2e5654e027b6 (diff)
Merge "binding: mediaplayer: fix duplicate entries being added to playlist" into eel
-rw-r--r--binding/afm-mediaplayer-binding.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index b8e2f47..600f6de 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -166,6 +166,11 @@ static int set_media_uri(struct playlist_item *item)
return 0;
}
+static int in_list(gconstpointer item, gconstpointer list) {
+ return g_strcmp0(((struct playlist_item *) item)->media_path,
+ ((struct playlist_item *) list)->media_path);
+}
+
static void populate_playlist(json_object *jquery)
{
int i, idx = 0;
@@ -185,7 +190,7 @@ static void populate_playlist(json_object *jquery)
break;
ret = populate_from_json(item, jdict);
- if (!ret) {
+ if (!ret || g_list_find_custom(playlist, item, in_list)) {
g_free_playlist_item(item);
continue;
}