diff options
author | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-02 21:08:25 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-07-02 21:08:25 +0200 |
commit | c3cdc31f0d3b2fd3313cba5044e1207adba81048 (patch) | |
tree | abb478451598fd038bfd0e8a0ada849cd4c46765 | |
parent | a711635a5a031107da3ecc0b0e1c939277e34572 (diff) | |
download | pianobar-windows-c3cdc31f0d3b2fd3313cba5044e1207adba81048.tar.gz pianobar-windows-c3cdc31f0d3b2fd3313cba5044e1207adba81048.tar.bz2 pianobar-windows-c3cdc31f0d3b2fd3313cba5044e1207adba81048.zip |
client: Show real station when playing quickmix song
-rw-r--r-- | libpiano/src/main.c | 12 | ||||
-rw-r--r-- | libpiano/src/piano.h | 4 | ||||
-rw-r--r-- | libpiano/src/xml.c | 2 | ||||
-rw-r--r-- | src/main.c | 10 |
4 files changed, 25 insertions, 3 deletions
diff --git a/libpiano/src/main.c b/libpiano/src/main.c index d8d9498..4e72629 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -141,6 +141,7 @@ void PianoDestroyPlaylist (PianoHandle_t *ph) { PianoFree (curSong->title, 0); PianoFree (curSong->userSeed, 0); PianoFree (curSong->identity, 0); + PianoFree (curSong->stationId, 0); lastSong = curSong; curSong = curSong->next; PianoFree (lastSong, sizeof (*lastSong)); @@ -653,3 +654,14 @@ PianoReturn_t PianoSetQuickmix (PianoHandle_t *ph) { return ret; } + +PianoStation_t *PianoFindStationById (PianoStation_t *stations, + char *searchStation) { + while (stations != NULL) { + if (strcmp (stations->id, searchStation) == 0) { + return stations; + } + stations = stations->next; + } + return NULL; +} diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h index 93c9fc1..7ee69fa 100644 --- a/libpiano/src/piano.h +++ b/libpiano/src/piano.h @@ -90,7 +90,7 @@ struct PianoSong { /* disabled: artistExplorerUrl */ /* disabled: artRadio */ //char *audioEncoding; /* FIXME: should be enum: mp3 or aacplus */ - //char *stationId; + char *stationId; //char *album; //char *artistMusicId; char *userSeed; @@ -169,5 +169,7 @@ PianoReturn_t PianoStationAddMusic (PianoHandle_t *ph, PianoStation_t *station, char *musicId); PianoReturn_t PianoSongTired (PianoHandle_t *ph, PianoSong_t *song); PianoReturn_t PianoSetQuickmix (PianoHandle_t *ph); +PianoStation_t *PianoFindStationById (PianoStation_t *stations, + char *searchStation); #endif /* _PIANO_H */ diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index ecd3394..a9be0a8 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -253,6 +253,8 @@ void PianoXmlParsePlaylistCb (char *key, xmlNode *value, void *data) { } else { song->rating = PIANO_RATE_NONE; } + } else if (strcmp ("stationId", key) == 0) { + song->stationId = strdup (valueStr); } } @@ -336,9 +336,15 @@ int main (int argc, char **argv) { } } if (curSong != NULL) { - printf ("\"%s\" by \"%s\"%s\n", curSong->title, + PianoStation_t *realStation = + PianoFindStationById (ph.stations, + curSong->stationId); + printf ("\"%s\" by \"%s\"%s%s%s\n", curSong->title, curSong->artist, (curSong->rating == - PIANO_RATE_LOVE) ? " (Loved)" : ""); + PIANO_RATE_LOVE) ? " (Loved)" : "", + curStation->isQuickMix ? " @ ": "", + curStation->isQuickMix ? realStation->name : + ""); /* setup artist and song name for scrobbling (curSong * may be NULL later) */ WardrobeSongInit (&scrobbleSong); |