[grilo-plugins/0.2.x] freebox: Fix non-unique IDs for radios



commit 34cca8d78c2d75378e46eca3a319ab8b65ef186d
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 20 15:49:43 2015 +0100

    freebox: Fix non-unique IDs for radios
    
    As we were using only the URL to differentiate media and that multiple
    radios have the same URL but different audio tracks, a lot of radios had
    the same ID. Fix this by using the audio track ID as well in the ID.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=758404

 src/freebox/grl-freebox.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/freebox/grl-freebox.c b/src/freebox/grl-freebox.c
index fff76ae..7310c57 100644
--- a/src/freebox/grl-freebox.c
+++ b/src/freebox/grl-freebox.c
@@ -384,6 +384,7 @@ filter_func_radio (GrlSource   *source,
   GrlMedia *ret;
   const gchar *title;
   char *new_title;
+  char *id;
 
   title = grl_media_get_title (media);
   if (title == NULL) {
@@ -399,7 +400,11 @@ filter_func_radio (GrlSource   *source,
 
   ret = grl_media_audio_new ();
   grl_media_set_url (ret, grl_media_get_url (media));
-  grl_media_set_id (ret, grl_media_get_url (media));
+  id = g_strdup_printf ("%s-%d",
+                        grl_media_get_url (media),
+                        grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_AUDIO_TRACK));
+  grl_media_set_id (ret, id);
+  g_free (id);
   grl_data_set_int (GRL_DATA (ret), GRL_METADATA_KEY_AUDIO_TRACK,
                     grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_AUDIO_TRACK));
   /* We'll add icon when http://dev.freebox.fr/bugs/task/14946 is fixed */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]