diff options
author | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-07 21:46:32 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-07 21:46:32 +0200 |
commit | eb46d942e5ecf50ff9f85ee62ea2fa454aa228fa (patch) | |
tree | 4e1d0fab3eff575274f6ec334680d51936675c7e | |
parent | e0b48b5fcc97b4979b32c79fe82c2fab5af89b86 (diff) | |
download | pianobar-windows-eb46d942e5ecf50ff9f85ee62ea2fa454aa228fa.tar.gz pianobar-windows-eb46d942e5ecf50ff9f85ee62ea2fa454aa228fa.tar.bz2 pianobar-windows-eb46d942e5ecf50ff9f85ee62ea2fa454aa228fa.zip |
Use album title too (for scrobbling, e.g.)
-rw-r--r-- | libpiano/src/main.c | 2 | ||||
-rw-r--r-- | libpiano/src/piano.h | 2 | ||||
-rw-r--r-- | libpiano/src/xml.c | 2 | ||||
-rw-r--r-- | libwardrobe/src/main.c | 9 | ||||
-rw-r--r-- | libwardrobe/src/wardrobe.h | 1 | ||||
-rw-r--r-- | src/main.c | 6 |
6 files changed, 16 insertions, 6 deletions
diff --git a/libpiano/src/main.c b/libpiano/src/main.c index 7c9115b..1839c0c 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -142,6 +142,7 @@ void PianoDestroyPlaylist (PianoHandle_t *ph) { PianoFree (curSong->userSeed, 0); PianoFree (curSong->identity, 0); PianoFree (curSong->stationId, 0); + PianoFree (curSong->album, 0); lastSong = curSong; curSong = curSong->next; PianoFree (lastSong, sizeof (*lastSong)); @@ -201,6 +202,7 @@ PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password) { requestStr = PianoEncryptString (requestStrPlain); snprintf (url, sizeof (url), PIANO_SECURE_RPC_URL "rid=%s" "&method=authenticateListener", ph->routeId); + if ((ret = PianoHttpPost (ph->curlHandle, url, requestStr, &retStr)) == PIANO_RET_OK) { ret = PianoXmlParseUserinfo (ph, retStr); diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h index 3dc512f..ce68c48 100644 --- a/libpiano/src/piano.h +++ b/libpiano/src/piano.h @@ -91,7 +91,7 @@ struct PianoSong { /* disabled: artRadio */ //char *audioEncoding; /* FIXME: should be enum: mp3 or aacplus */ char *stationId; - //char *album; + char *album; //char *artistMusicId; char *userSeed; /* disabled: albumExplorerUrl */ diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index 377affb..a144255 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -255,6 +255,8 @@ void PianoXmlParsePlaylistCb (char *key, xmlNode *value, void *data) { } } else if (strcmp ("stationId", key) == 0) { song->stationId = strdup (valueStr); + } else if (strcmp ("albumTitle", key) == 0) { + song->album = strdup (valueStr); } } diff --git a/libwardrobe/src/main.c b/libwardrobe/src/main.c index cfe9395..0a8a14e 100644 --- a/libwardrobe/src/main.c +++ b/libwardrobe/src/main.c @@ -129,6 +129,7 @@ void WardrobeFree (void *ptr, size_t size) { void WardrobeSongDestroy (WardrobeSong_t *ws) { WardrobeFree (ws->artist, 0); WardrobeFree (ws->title, 0); + WardrobeFree (ws->album, 0); memset (ws, 0, sizeof (*ws)); } @@ -207,16 +208,17 @@ WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) { WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh, WardrobeSong_t *ws) { char postContent[10000]; - char *urlencArtist, *urlencTitle, *ret; + char *urlencArtist, *urlencTitle, *urlencAlbum, *ret; WardrobeReturn_t fRet = WARDROBE_RET_ERR; urlencArtist = curl_easy_escape (wh->ch, ws->artist, 0); urlencTitle = curl_easy_escape (wh->ch, ws->title, 0); + urlencAlbum = curl_easy_escape (wh->ch, ws->album, 0); 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]=&n[0]=&m[0]=", + "i[0]=%li&o[0]=P&r[0]=&l[0]=%li&b[0]=%s&n[0]=&m[0]=", wh->authToken, urlencArtist, urlencTitle, ws->started, - ws->length); + ws->length, urlencAlbum); WardrobeHttpPost (wh->ch, wh->postUrl, postContent, &ret); if (memcmp (ret, "OK", 2) == 0) { @@ -227,6 +229,7 @@ WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh, curl_free (urlencArtist); curl_free (urlencTitle); + curl_free (urlencAlbum); WardrobeFree (ret, 0); return fRet; diff --git a/libwardrobe/src/wardrobe.h b/libwardrobe/src/wardrobe.h index aeeda87..5662139 100644 --- a/libwardrobe/src/wardrobe.h +++ b/libwardrobe/src/wardrobe.h @@ -35,6 +35,7 @@ typedef struct { typedef struct { char *artist; char *title; + char *album; time_t started; time_t length; } WardrobeSong_t; @@ -342,8 +342,9 @@ int main (int argc, char **argv) { PianoStation_t *realStation = PianoFindStationById (ph.stations, curSong->stationId); - printf ("\"%s\" by \"%s\"%s%s%s\n", curSong->title, - curSong->artist, (curSong->rating == + printf ("\"%s\" by \"%s\" on \"%s\"%s%s%s\n", + curSong->title, curSong->artist, curSong->album, + (curSong->rating == PIANO_RATE_LOVE) ? " (Loved)" : "", curStation->isQuickMix ? " @ ": "", curStation->isQuickMix ? realStation->name : @@ -353,6 +354,7 @@ int main (int argc, char **argv) { WardrobeSongInit (&scrobbleSong); scrobbleSong.artist = strdup (curSong->artist); scrobbleSong.title = strdup (curSong->title); + scrobbleSong.album = strdup (curSong->album); scrobbleSong.started = time (NULL); memset (&player, 0, sizeof (player)); |