[discident-glib] ean: Add support for the FR and US variants of RL



commit 0ecc34066f6d83942791ce3cf255b3d918e0f757
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Apr 7 01:28:46 2013 +0200

    ean: Add support for the FR and US variants of RL

 discident-glib/discident-ean-rl-glib.c |   10 ++--------
 discident-glib/test-diglib.c           |    9 +++++++++
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/discident-glib/discident-ean-rl-glib.c b/discident-glib/discident-ean-rl-glib.c
index 0712113..c08f75d 100644
--- a/discident-glib/discident-ean-rl-glib.c
+++ b/discident-glib/discident-ean-rl-glib.c
@@ -35,7 +35,7 @@
 #define EMULATED_VERSION "2.7.0"
 #define ORIGINAL_QUERY "http://redlaser.com:8008/getinfo.ashx?v="; EMULATED_VERSION 
"&app=rl&responseId=20100708&udid=" APPID
 #define SEARCH_URL "http://%s/searchresults.ashx";
-#define SEARCH_QUERY 
"barcode=%s&btype=EAN13&cachedimages=ebay_small,googlelogo_24,thefindlogo&currency=GBP&locale=en_GB&udid=" 
APPID "&v=" EMULATED_VERSION
+#define SEARCH_QUERY 
"barcode=%s&btype=EAN13&cachedimages=ebay_small,googlelogo_24,thefindlogo&currency=GBP&locale=%s&udid=" APPID 
"&v=" EMULATED_VERSION
 
 static gboolean
 parse_login_response (DiscidentEan *ean,
@@ -139,12 +139,6 @@ get_search_uri (DiscidentEan *ean)
 }
 
 static char *
-get_post_data (const char *barcode)
-{
-       return g_strdup_printf (SEARCH_QUERY, barcode);
-}
-
-static char *
 uncompress (const char *data,
            gssize      len)
 {
@@ -230,7 +224,7 @@ create_query_message (DiscidentEan *ean,
        msg = soup_message_new ("POST", uri);
        g_free (uri);
 
-       data = get_post_data (barcode);
+       data = g_strdup_printf (SEARCH_QUERY, barcode, ean->priv->service + strlen ("rl-"));
        soup_message_set_request (msg, "application/x-www-form-urlencoded",
                                  SOUP_MEMORY_TAKE, data, strlen (data));
 
diff --git a/discident-glib/test-diglib.c b/discident-glib/test-diglib.c
index b9cb6e0..0778130 100644
--- a/discident-glib/test-diglib.c
+++ b/discident-glib/test-diglib.c
@@ -123,6 +123,15 @@ test_ean_fail (void)
        g_free (title);
        g_free (img_url);
        g_object_unref (ean);
+
+       ean = discident_ean_new ("rl-fr_FR");
+
+       /* But works with the FR check */
+       ret = discident_ean_lookup_sync (ean, "3388330031138", &title, NULL, &error);
+       g_assert (ret == TRUE);
+       g_assert_cmpstr ("GHOST IN THE SHELL (1995 DVD NON MUSICAL)", ==, title);
+       g_free (title);
+       g_object_unref (ean);
 }
 
 static void


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