[grilo-plugins] bliptv: Check for no search results



commit cfde82961e989a0000e035f9d4aeba5ed85063af
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Jul 9 13:05:58 2013 +0000

    bliptv: Check for no search results
    
    When performing a search, and no results are found, instead of getting an empty
    result dataset, Blip.tv returns just one "virtual" element telling there are
    not results.
    
    This commit checks for this case, and returns no results in case of matching
    it.

 src/bliptv/grl-bliptv.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/bliptv/grl-bliptv.c b/src/bliptv/grl-bliptv.c
index ea29936..c3cbcda 100644
--- a/src/bliptv/grl-bliptv.c
+++ b/src/bliptv/grl-bliptv.c
@@ -306,6 +306,22 @@ call_raw_async_cb (GObject *     source_object,
     goto finalize_send_last;
   }
 
+  /* Special case: when there are no results in a search, Blip.tv returns an
+     element telling precisely that, no results found; so we need to report no
+     results too */
+  if (nb_items == 1) {
+    obj = xmlXPathEvalExpression ((xmlChar *) "string(/rss/channel/item[0]/blip:item_id)", xpath);
+    if (!obj || !obj->stringval || obj->stringval[0] == '\0') {
+      if (obj) {
+        xmlXPathFreeObject (obj);
+      }
+      nb_items = 0;
+      goto finalize_send_last;
+    } else {
+      xmlXPathFreeObject (obj);
+    }
+  }
+
   for (i = op->skip; i < nb_items; i++)
     {
       GList *mapping = bliptv_mappings;


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