[grilo-plugins/0.2.x] jamendo: Fix "format not a string literal" error



commit cc5796ae49e2dc85c0cb040ee7ded6cc106e17d2
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 22 16:22:31 2016 +0100

    jamendo: Fix "format not a string literal" error
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764486

 src/jamendo/grl-jamendo.c |   86 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 65 insertions(+), 21 deletions(-)
---
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 035b124..388bdb1 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -141,10 +141,12 @@ typedef struct {
   gboolean cancelled;
 } XmlParseEntries;
 
+/* Note: you'll also need to update
+ * grl_jamendo_source_browse() */
 struct Feeds {
   gchar *name;
   JamendoCategory cat;
-  gchar *url;
+  const gchar *url;
 } feeds[] = {
   { N_("Albums of the week"), JAMENDO_ALBUM_CAT,
     JAMENDO_GET_ALBUMS "&order=ratingweek_desc", },
@@ -1168,10 +1170,46 @@ grl_jamendo_source_browse (GrlSource *source,
 
         feed_id = atoi (container_split[1]);
         jamendo_keys = get_jamendo_keys (feeds[feed_id].cat);
-        url = g_strdup_printf (feeds[feed_id].url,
-                               jamendo_keys,
-                               page_size,
-                               page_number);
+        switch (feed_id) {
+        case 0:
+          url = g_strdup_printf (JAMENDO_GET_ALBUMS "&order=ratingweek_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        case 1:
+          url = g_strdup_printf (JAMENDO_GET_TRACKS "&order=ratingweek_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        case 2:
+          url = g_strdup_printf (JAMENDO_GET_TRACKS "&order=releasedate_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        case 3:
+          url = g_strdup_printf (JAMENDO_GET_ARTISTS "&order=rating_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        case 4:
+          url = g_strdup_printf (JAMENDO_GET_ALBUMS "&order=rating_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        case 5:
+          url = g_strdup_printf (JAMENDO_GET_TRACKS "&order=rating_desc",
+                                 jamendo_keys,
+                                 page_size,
+                                 page_number);
+          break;
+        default:
+          g_assert_not_reached ();
+        }
         g_free (jamendo_keys);
       } else {
         send_feeds (bs);
@@ -1228,7 +1266,6 @@ grl_jamendo_source_query (GrlSource *source,
   gchar *term = NULL;
   gchar *url;
   gchar *jamendo_keys = NULL;
-  gchar *query = NULL;
   XmlParseEntries *xpe = NULL;
   guint page_size;
   guint page_number;
@@ -1246,33 +1283,40 @@ grl_jamendo_source_query (GrlSource *source,
     goto send_error;
   }
 
+  grl_paging_translate (skip,
+                        count,
+                        0,
+                        &page_size,
+                        &page_number,
+                        &page_offset);
+
   jamendo_keys = get_jamendo_keys (category);
   switch (category) {
   case JAMENDO_ARTIST_CAT:
-    query = JAMENDO_SEARCH_ARTIST;
+    url = g_strdup_printf (JAMENDO_SEARCH_ARTIST,
+                           jamendo_keys,
+                           page_size,
+                           page_number,
+                           term);
     break;
   case JAMENDO_ALBUM_CAT:
-    query = JAMENDO_SEARCH_ALBUM;
+    url = g_strdup_printf (JAMENDO_SEARCH_ALBUM,
+                           jamendo_keys,
+                           page_size,
+                           page_number,
+                           term);
     break;
   case JAMENDO_TRACK_CAT:
-    query = JAMENDO_SEARCH_TRACK;
+    url = g_strdup_printf (JAMENDO_SEARCH_TRACK,
+                           jamendo_keys,
+                           page_size,
+                           page_number,
+                           term);
     break;
   default:
     g_return_if_reached ();
   }
 
-  grl_paging_translate (skip,
-                        count,
-                        0,
-                        &page_size,
-                        &page_number,
-                        &page_offset);
-
-  url = g_strdup_printf (query,
-                         jamendo_keys,
-                         page_size,
-                         page_number,
-                         term);
   g_free (term);
   g_free (jamendo_keys);
 


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