From 83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 29 May 2009 17:10:33 +0200 Subject: wardrobe: Fix scrobbling Broken since commit 56d47cd3584322b0d2984935ff278424695a4abf --- libwardrobe/src/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libwardrobe/src') diff --git a/libwardrobe/src/main.c b/libwardrobe/src/main.c index 84e9ad9..a4583d1 100644 --- a/libwardrobe/src/main.c +++ b/libwardrobe/src/main.c @@ -101,6 +101,9 @@ WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { wh->user, currTStamp, pwDigest); WaitressSetHPP (&wh->waith, "post.audioscrobbler.com", "80", url); + wh->waith.method = WAITRESS_METHOD_GET; + wh->waith.postData = NULL; + wh->waith.extraHeaders = NULL; if (WaitressFetchBuf (&wh->waith, ret, sizeof (ret)) != WAITRESS_RET_OK) { return WARDROBE_RET_CONNECT_ERR; } @@ -114,7 +117,7 @@ WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { for (i = 1; i < sizeof (newlines) / sizeof (*newlines); i++) { newlines[i] = strchr (newlines[i-1]+1, '\n'); } - /* copy needed values */ + /* copy needed values (auth token and post url) */ if (newlines[2] - newlines[1]-1 < sizeof (wh->authToken)) { memcpy (wh->authToken, newlines[1]+1, newlines[2] - newlines[1]-1); @@ -162,11 +165,14 @@ WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh, urlencAlbum = WaitressUrlEncode (ws->album); snprintf (postContent, sizeof (postContent), "s=%s&a[0]=%s&t[0]=%s&" - "i[0]=%li&o[0]=P&r[0]=&l[0]=%li&b[0]=%s&n[0]=&m[0]=", + "i[0]=%li&o[0]=E&r[0]=&l[0]=%li&b[0]=%s&n[0]=&m[0]=", wh->authToken, urlencArtist, urlencTitle, ws->started, ws->length, urlencAlbum); WaitressSetHPP (&wh->waith, wh->postHost, wh->postPort, wh->postPath); + wh->waith.method = WAITRESS_METHOD_POST; + wh->waith.postData = postContent; + wh->waith.extraHeaders = "Content-Type: application/x-www-form-urlencoded\r\n"; if (WaitressFetchBuf (&wh->waith, ret, sizeof (ret)) != WAITRESS_RET_OK) { return WARDROBE_RET_CONNECT_ERR; } -- cgit v1.2.3