# HG changeset patch # User nemo # Date 1141591591 28800 # Node ID 1c2c92c7f222c173f2873519dfb4fc2c7fd56fbb # Parent ec9ba0ad38a853fa35aecb912e55930c00bddc99 [svn] Bug #423 - Add retrieval of first entry in case of multiple matches. Good enough to remove the FIXME? diff -r ec9ba0ad38a8 -r 1c2c92c7f222 Plugins/Input/cdaudio/cddb.c --- a/Plugins/Input/cdaudio/cddb.c Sat Mar 04 14:34:04 2006 -0800 +++ b/Plugins/Input/cdaudio/cddb.c Sun Mar 05 12:46:31 2006 -0800 @@ -207,7 +207,6 @@ return FALSE; } - http_close_connection(sock); response = g_strsplit(buffer, " ", 4); cddb_log("Query response: %s", buffer); @@ -224,10 +223,28 @@ cddb_info->category = g_strdup(response[1]); cddb_info->discid = strtoul(response[2], NULL, 16); break; + case 211: + /* multiple matches - use first match */ + g_strfreev(response); + if (http_read_first_line(sock, buffer, 256) < 0) { + http_close_connection(sock); + return FALSE; + } + response = g_strsplit(buffer, " ", 4); + for (i = 0; i < 4; i++) { + if (response[i] == NULL) { + g_strfreev(response); + return FALSE; + } + } + cddb_info->category = g_strdup(response[1]); + cddb_info->discid = strtoul(response[2], NULL, 16); + break; default: /* FIXME: Handle other 2xx */ g_strfreev(response); return FALSE; } + http_close_connection(sock); g_strfreev(response); return TRUE;