[grilo-plugins] Limit max. amount of requesting elements in each step



commit b69c982520f2e931bf53f5320bee9a6f25a578ec
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue May 11 13:39:07 2010 +0200

    Limit max. amount of requesting elements in each step
    
    If we try to get all elements from Jamendo in a single step, is posible that
    Jamendo returns nothing.
    
    So better split queries so in each step up to 100 elements are requested.

 src/jamendo/grl-jamendo.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index d16fac6..c146250 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -43,6 +43,8 @@
 #define JAMENDO_ID_SEP    "/"
 #define JAMENDO_ROOT_NAME "Jamendo"
 
+#define MAX_ELEMENTS 100
+
 /* ------- Categories ------- */
 
 #define JAMENDO_ARTIST "artist"
@@ -216,6 +218,10 @@ grl_jamendo_source_class_init (GrlJamendoSourceClass * klass)
 static void
 grl_jamendo_source_init (GrlJamendoSource *source)
 {
+  /* If we try to get too much elements in a single step, Jamendo might return
+     nothing. So limit the maximum amount of elements in each query */
+  grl_media_source_set_auto_split_threshold (GRL_MEDIA_SOURCE (source),
+                                             MAX_ELEMENTS);
 }
 
 G_DEFINE_TYPE (GrlJamendoSource, grl_jamendo_source, GRL_TYPE_MEDIA_SOURCE);



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