changeset 1172:93dee80e9365 trunk

[svn] - fix scrobble from queue
author desowin
date Fri, 08 Jun 2007 06:27:15 -0700
parents cbe5598f5de4
children 5896bd827cbc
files ChangeLog src/scrobbler/scrobbler.c
diffstat 2 files changed, 48 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 08 04:37:56 2007 -0700
+++ b/ChangeLog	Fri Jun 08 06:27:15 2007 -0700
@@ -1,3 +1,10 @@
+2007-06-08 11:37:56 +0000  Tomasz Mon <desowin@atheme.org>
+  revision [2536]
+  - keep old passwords if user doesn't change them in configuration
+  trunk/src/scrobbler/configure.c |    4 ++--
+  1 file changed, 2 insertions(+), 2 deletions(-)
+
+
 2007-06-07 15:28:08 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [2528]
   - fix a possible allocation overflow issue. found while merging to 1.3 stable.
--- a/src/scrobbler/scrobbler.c	Fri Jun 08 04:37:56 2007 -0700
+++ b/src/scrobbler/scrobbler.c	Fri Jun 08 06:27:15 2007 -0700
@@ -75,6 +75,44 @@
 static item_t *q_queue_last = NULL;
 static int q_nitems;
 
+gchar *
+xmms_urldecode_plain(const gchar * encoded_path)
+{
+    const gchar *cur, *ext;
+    gchar *path, *tmp;
+    gint realchar;
+
+    if (!encoded_path)
+        return NULL;
+
+    cur = encoded_path;
+    if (*cur == '/')
+        while (cur[1] == '/')
+            cur++;
+
+    tmp = g_malloc0(strlen(cur) + 1);
+
+    while ((ext = strchr(cur, '%')) != NULL) {
+        strncat(tmp, cur, ext - cur);
+        ext++;
+        cur = ext + 2;
+        if (!sscanf(ext, "%2x", &realchar)) {
+            /*
+             * Assume it is a literal '%'.  Several file
+             * managers send unencoded file: urls on on
+             * drag and drop.
+             */
+            realchar = '%';
+            cur -= 2;
+        }
+        tmp[strlen(tmp)] = realchar;
+    }
+
+    path = g_strconcat(tmp, cur, NULL);
+    g_free(tmp);
+    return path;
+}
+
 static void q_item_free(item_t *item)
 {
 	if (item == NULL)
@@ -842,9 +880,9 @@
 		{
 			TitleInput *tuple = bmp_title_input_new();
 
-			tuple->performer = g_strdup(artist);
-			tuple->track_name = g_strdup(title);
-			tuple->album_name = g_strdup(album);
+			tuple->performer = g_strdup(xmms_urldecode_plain(artist));
+			tuple->track_name = g_strdup(xmms_urldecode_plain(title));
+			tuple->album_name = g_strdup(xmms_urldecode_plain(album));
 
 			item = q_put(tuple, atoi(len));