diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-05-08 02:34:11 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-05-14 13:28:45 +0000 |
commit | 6fbd3e296843993e487af446642e2e5654e027b6 (patch) | |
tree | 9ba6b42a8da667684530e69e04d8f0c85b3acaad /binding | |
parent | fba3216156bccf7ca1424e4e4e389369c4eccefe (diff) |
binding: mediaplayer: fix duplicate entries being added to playlist
Check playlist for an entry with the current media_path and refuse to add
to the list if it exists
Bug-AGL: SPEC-1375
Change-Id: Idc5fb4b2570ed7ac9cf63aa3c37e44b8e35d6b34
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
(cherry picked from commit 8fd47cf37b0bfc8d454d12c444ce8d4272e068d2)
Diffstat (limited to 'binding')
-rw-r--r-- | binding/afm-mediaplayer-binding.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index 1c2ce6a..f3cebf5 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; } |