summaryrefslogtreecommitdiff
path: root/libwardrobe
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-05-29 17:10:33 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-05-29 17:10:33 +0200
commit83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6 (patch)
tree1f3d57e8ce82ffffd39a84e382754e5cc50c0d09 /libwardrobe
parentc5f91ad646b0f540407d113b27c20d79108ec24d (diff)
downloadpianobar-windows-83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6.tar.gz
pianobar-windows-83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6.tar.bz2
pianobar-windows-83bfec016bd1a0c50f2d34822ecd1be4a2c8a4c6.zip
wardrobe: Fix scrobbling
Broken since commit 56d47cd3584322b0d2984935ff278424695a4abf
Diffstat (limited to 'libwardrobe')
-rw-r--r--libwardrobe/src/main.c10
1 files changed, 8 insertions, 2 deletions
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;
}