From 3911da5c6169877988b061d1de9b475f5789ba69 Mon Sep 17 00:00:00 2001 From: Andreas Obergrusberger Date: Fri, 18 Jan 2008 13:53:06 +0000 Subject: improve escaping of URLs git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@7141 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/lyrics_leoslyrics.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lyrics_leoslyrics.c') diff --git a/src/lyrics_leoslyrics.c b/src/lyrics_leoslyrics.c index 4afb3fa7b..99dac9dde 100644 --- a/src/lyrics_leoslyrics.c +++ b/src/lyrics_leoslyrics.c @@ -95,13 +95,14 @@ static void fetch_text(void *userData, const XML_Char *s, int len) int check_lyr_leoslyrics(char *artist, char *title, char *url) { char url_avail[256]; + CURL *curl = curl_easy_init (); + //this replacess the whitespaces with '+' - g_strdelimit(artist, " ", '+'); - g_strdelimit(title, " ", '+'); - + char *esc_title = curl_easy_escape (curl, title, 0); + char *esc_artist = curl_easy_escape (curl, artist, 0); //we insert the artist and the title into the url - snprintf(url_avail, 512, LEOSLYRICS_SEARCH_URL, artist, title); + snprintf(url_avail, 512, LEOSLYRICS_SEARCH_URL, esc_artist, esc_title); //download that xml! easy_download_struct lyr_avail = {NULL, 0,-1}; @@ -121,7 +122,6 @@ int check_lyr_leoslyrics(char *artist, char *title, char *url) if(!(result & 4)) return -1; //check whether lyrics found - CURL *curl = curl_easy_init (); char *esc_hid = curl_easy_escape (curl, hid, 0); free (hid); -- cgit v1.2.3