Re: Vimeo plugin



O Lun, 03-05-2010 ás 12:20 +0200, Juan A. Suarez Romero escribiu: 
> On Mon, 2010-05-03 at 10:53 +0200, Xabier Rodriguez Calvar wrote:
> > I am already doing that, but I got some trouble to test some plugins, so
> > it is taking some time. Code is already written.
> 
> Oh! Good. Thanks, Xabier.

It seems to work properly, but I encourage you to test it yourself.

Br.

-- 
Xabier Rodríguez Calvar
Enxeñeiro en Informática
IGALIA http://www.igalia.com
From 060dede743e9492f7c4eaf529cd0fd32193cf492 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 27 Apr 2010 13:59:17 +0200
Subject: [PATCH 1/6] [apple-trailers] Changed to use xmlReadMemory instead of xmlRecoverDoc

---
 src/apple-trailers/grl-apple-trailers.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index 521aad1..f771801 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -298,7 +298,8 @@ xml_parse_result (const gchar *str, OperationData *op_data)
     goto finalize;
   }
 
-  op_data->xml_doc = xmlRecoverDoc ((xmlChar *) str);
+  op_data->xml_doc = xmlReadMemory (str, xmlStrlen ((xmlChar*) str), NULL, NULL,
+                                    XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   if (!op_data->xml_doc) {
     error = g_error_new (GRL_ERROR,
                          GRL_ERROR_BROWSE_FAILED,
-- 
1.7.0

From a041f1b0962b7492fee6d2ca1b9ec03269986876 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 27 Apr 2010 14:00:48 +0200
Subject: [PATCH 2/6] [jamendo] Changed to use xmlReadMemory instead of xmlRecoverDoc

Now the function to skip the text nodes is useless and it was also
removed.
---
 src/jamendo/grl-jamendo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index a144619..d16fac6 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -289,7 +289,8 @@ xml_parse_result (const gchar *str, GError **error, XmlParseEntries *xpe)
   xmlNodePtr node;
   gint child_nodes = 0;
 
-  doc = xmlRecoverDoc ((xmlChar *) str);
+  doc = xmlReadMemory (str, strlen (str), NULL, NULL,
+                       XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   if (!doc) {
     *error = g_error_new (GRL_ERROR,
 			  GRL_ERROR_BROWSE_FAILED,
-- 
1.7.0

From 0c834566284704000bcf64bf72d2e93db8eb046c Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 27 Apr 2010 15:25:13 +0200
Subject: [PATCH 3/6] [shoutcast] Replaced xmlRecoverDoc with xmlReadMemory.

skip_garbage nodes is not useful anymore so it was removed.
---
 src/shoutcast/grl-shoutcast.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c
index 691313a..3a7a577 100644
--- a/src/shoutcast/grl-shoutcast.c
+++ b/src/shoutcast/grl-shoutcast.c
@@ -162,17 +162,6 @@ G_DEFINE_TYPE (GrlShoutcastSource, grl_shoutcast_source, GRL_TYPE_MEDIA_SOURCE);
 
 /* ======================= Private ==================== */
 
-static void
-skip_garbage_nodes (xmlNodePtr *node)
-{
-  /* Result contains "\n" and "\t" to pretty align XML. Unfortunately, libxml
-     doesn't cope very fine with them, and it creates "fakes" nodes with name
-     "text" and value those characters. So we need to skip them */
-  while ((*node) && xmlStrcmp ((*node)->name, (const xmlChar *) "text") == 0) {
-    (*node) = (*node)->next;
-  }
-}
-
 static gint
 xml_count_nodes (xmlNodePtr node)
 {
@@ -181,7 +170,6 @@ xml_count_nodes (xmlNodePtr node)
   while (node) {
     count++;
     node = node->next;
-    skip_garbage_nodes (&node);
   }
 
   return count;
@@ -274,7 +262,6 @@ send_media (OperationData *op_data, GrlMedia *media)
                         NULL);
 
     op_data->xml_entries = op_data->xml_entries->next;
-    skip_garbage_nodes (&op_data->xml_entries);
   }
 
   if (op_data->to_send == 0 || op_data->cancelled) {
@@ -315,7 +302,8 @@ xml_parse_result (const gchar *str, OperationData *op_data)
     return;
   }
 
-  op_data->xml_doc = xmlRecoverDoc ((xmlChar *) str);
+  op_data->xml_doc = xmlReadMemory (str, xmlStrlen ((xmlChar*) str), NULL, NULL,
+                                    XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   if (!op_data->xml_doc) {
     error = g_error_new (GRL_ERROR,
                          op_data->error_code,
@@ -335,7 +323,6 @@ xml_parse_result (const gchar *str, OperationData *op_data)
                                    (const xmlChar *) "stationlist") == 0);
 
   op_data->xml_entries = node->xmlChildrenNode;
-  skip_garbage_nodes (&op_data->xml_entries);
 
   /* Check if we are interesting only in updating a media (that is, a metadata()
      operation) or just browsing/searching */
@@ -389,13 +376,11 @@ xml_parse_result (const gchar *str, OperationData *op_data)
   if (stationlist_result) {
     /* First node is "tunein"; skip it */
     op_data->xml_entries = op_data->xml_entries->next;
-    skip_garbage_nodes (&op_data->xml_entries);
   }
 
   /* Skip elements */
   while (op_data->xml_entries && op_data->skip > 0) {
     op_data->xml_entries = op_data->xml_entries->next;
-    skip_garbage_nodes (&op_data->xml_entries);
     op_data->skip--;
   }
 
-- 
1.7.0

From eeb6e6ba6dc3bdd31205da13f632f987ea8cb486 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 27 Apr 2010 15:48:25 +0200
Subject: [PATCH 4/6] [flickr] Changed xmlRecoverDoc to xmlReadMemory

skip_garbage_nodes is not usefull anymore as text nodes are already
removed.
---
 src/flickr/gflickr.c |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/flickr/gflickr.c b/src/flickr/gflickr.c
index 4053542..00d264f 100644
--- a/src/flickr/gflickr.c
+++ b/src/flickr/gflickr.c
@@ -145,17 +145,6 @@ get_api_sig_photos_getInfo (GFlickr *f, glong photo_id)
   return signature;
 }
 
-static void
-skip_garbage_nodes (xmlNodePtr *node)
-{
-  /* Result contains "\n" and "\t" to pretty align XML. Unfortunately, libxml
-     doesn't cope very fine with them, and it creates "fakes" nodes with name
-     "text" and value those characters. So we need to skip them */
-  while ((*node) && xmlStrcmp ((*node)->name, (const xmlChar *) "text") == 0) {
-    (*node) = (*node)->next;
-  }
-}
-
 static gboolean
 result_is_correct (xmlNodePtr node)
 {
@@ -202,7 +191,6 @@ get_photo (xmlNodePtr node)
   /* Add children nodes with their properties */
 
   node = node->xmlChildrenNode;
-  skip_garbage_nodes (&node);
 
   while (node) {
     if (xmlStrcmp (node->name, (const xmlChar *) "owner") == 0 ||
@@ -216,7 +204,6 @@ get_photo (xmlNodePtr node)
     }
 
     node = node->next;
-    skip_garbage_nodes (&node);
   }
 
   return photo;
@@ -230,7 +217,8 @@ process_photo_result (const gchar *xml_result, gpointer user_data)
   GFlickrData *data = (GFlickrData *) user_data;
   GHashTable *photo;
 
-  doc = xmlRecoverDoc ((xmlChar *) xml_result);
+  doc = xmlReadMemory (xml_result, xmlStrlen ((xmlChar*) xml_result), NULL,
+                       NULL, XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   node = xmlDocGetRootElement (doc);
 
   /* Check result is ok */
@@ -238,7 +226,6 @@ process_photo_result (const gchar *xml_result, gpointer user_data)
     data->get_info_cb (NULL, NULL, data->user_data);
   } else {
     node = node->xmlChildrenNode;
-    skip_garbage_nodes (&node);
 
     photo = get_photo (node);
     data->get_info_cb (NULL, photo, data->user_data);
@@ -256,7 +243,8 @@ process_photolist_result (const gchar *xml_result, gpointer user_data)
   xmlDocPtr doc;
   xmlNodePtr node;
 
-  doc = xmlRecoverDoc ((xmlChar *) xml_result);
+  doc = xmlReadMemory (xml_result, xmlStrlen ((xmlChar*) xml_result), NULL,
+                       NULL, XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   node = xmlDocGetRootElement (doc);
 
   /* Check result is ok */
@@ -264,15 +252,12 @@ process_photolist_result (const gchar *xml_result, gpointer user_data)
     data->search_cb (NULL, NULL, data->user_data);
   } else {
     node = node->xmlChildrenNode;
-    skip_garbage_nodes (&node);
 
     /* Now we're at "photo pages" node */
     node = node->xmlChildrenNode;
-    skip_garbage_nodes (&node);
     while (node) {
       photolist = g_list_prepend (photolist, get_photo (node));
       node = node->next;
-      skip_garbage_nodes (&node);
     }
 
     data->search_cb (NULL, g_list_reverse (photolist), data->user_data);
-- 
1.7.0

From a0a5e370ba86c61a045355e3a70a4633c2032b15 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 4 May 2010 14:39:37 +0200
Subject: [PATCH 5/6] [youtube] Replaced xmlRecoverDoc with xmlReadMemory

---
 src/youtube/grl-youtube.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index 480cd1f..3f33b81 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -575,7 +575,8 @@ build_categories_directory_read_cb (gchar *xmldata, gpointer user_data)
     return;
   }
 
-  doc = xmlRecoverDoc ((xmlChar *) xmldata);
+  doc = xmlReadMemory (xmldata, strlen (xmldata), NULL, NULL,
+                       XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   if (!doc) {
     g_critical ("Failed to build category directory (2)");
     goto free_resources;
-- 
1.7.0

From af10ef3a731b7844ef2cb46413dd61775339c896 Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue, 4 May 2010 14:56:38 +0200
Subject: [PATCH 6/6] [lastfm-albumart] Replaced xmlRecoverDoc with xmlReadMemory

---
 src/lastfm-albumart/grl-lastfm-albumart.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/lastfm-albumart/grl-lastfm-albumart.c b/src/lastfm-albumart/grl-lastfm-albumart.c
index 40bfa7e..11169d1 100644
--- a/src/lastfm-albumart/grl-lastfm-albumart.c
+++ b/src/lastfm-albumart/grl-lastfm-albumart.c
@@ -139,7 +139,8 @@ xml_get_image (const gchar *xmldata)
   xmlXPathObjectPtr xpath_res;
   gchar *image;
 
-  doc = xmlRecoverDoc ((xmlChar *) xmldata);
+  doc = xmlReadMemory (xmldata, xmlStrlen ((xmlChar*) xmldata), NULL, NULL,
+                       XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
   if (!doc) {
     return NULL;
   }
-- 
1.7.0

Attachment: signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= unha parte de mensaxe asinada dixitalmente



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