summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan C. Muller <jcmuller@gmail.com>2010-11-23 15:17:43 -0500
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-11-23 22:12:29 +0100
commit91192bd1473d6a43eb27ea802ac6fbd451f28fb2 (patch)
tree5f0145b52859c1dedd2b0eaab6ef49ddd163382f
parentb1ed17b08da468589c178d4a21daa77a481a04c8 (diff)
downloadpianobar-windows-91192bd1473d6a43eb27ea802ac6fbd451f28fb2.tar.gz
pianobar-windows-91192bd1473d6a43eb27ea802ac6fbd451f28fb2.tar.bz2
pianobar-windows-91192bd1473d6a43eb27ea802ac6fbd451f28fb2.zip
Add support for art covers included in the XML playlist from pandora.
See issue #56
-rwxr-xr-xcontrib/eventcmd.sh2
-rw-r--r--libpiano/src/piano.c1
-rw-r--r--libpiano/src/piano.h1
-rw-r--r--libpiano/src/xml.c2
-rw-r--r--src/pianobar.12
-rw-r--r--src/ui.c2
-rw-r--r--src/ui_act.c5
7 files changed, 12 insertions, 3 deletions
diff --git a/contrib/eventcmd.sh b/contrib/eventcmd.sh
index 6e3a081..4a162a3 100755
--- a/contrib/eventcmd.sh
+++ b/contrib/eventcmd.sh
@@ -5,7 +5,7 @@ while read L; do
k="`echo "$L" | cut -d '=' -f 1`"
v="`echo "$L" | cut -d '=' -f 2`"
export "$k=$v"
-done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\)=' /dev/stdin) # don't overwrite $1...
+done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\)=' /dev/stdin) # don't overwrite $1...
case "$1" in
# songstart)
diff --git a/libpiano/src/piano.c b/libpiano/src/piano.c
index 52b72c4..f6343b4 100644
--- a/libpiano/src/piano.c
+++ b/libpiano/src/piano.c
@@ -120,6 +120,7 @@ void PianoDestroyPlaylist (PianoSong_t *playlist) {
curSong = playlist;
while (curSong != NULL) {
free (curSong->audioUrl);
+ free (curSong->coverArt);
free (curSong->artist);
free (curSong->musicId);
free (curSong->title);
diff --git a/libpiano/src/piano.h b/libpiano/src/piano.h
index 52cfa75..ef6e386 100644
--- a/libpiano/src/piano.h
+++ b/libpiano/src/piano.h
@@ -68,6 +68,7 @@ typedef struct PianoSong {
char *album;
char *userSeed;
char *audioUrl;
+ char *coverArt;
char *musicId;
char *title;
float fileGain;
diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c
index 36afc87..01294d8 100644
--- a/libpiano/src/xml.c
+++ b/libpiano/src/xml.c
@@ -259,6 +259,8 @@ static void PianoXmlParsePlaylistCb (const char *key, const ezxml_t value,
}
free (urlTail);
}
+ } else if (strcmp ("artRadio", key) == 0) {
+ song->coverArt = strdup (valueStr);
} else if (strcmp ("artistSummary", key) == 0) {
song->artist = strdup (valueStr);
} else if (strcmp ("musicId", key) == 0) {
diff --git a/src/pianobar.1 b/src/pianobar.1
index a27b606..6a6bd33 100644
--- a/src/pianobar.1
+++ b/src/pianobar.1
@@ -212,7 +212,7 @@ can report certain "events" to an external application (see
.B CONFIGURATION
). This application is started with the event name as it's first argument. More
information (artist, title, album, stationName, error code, error description,
-song length in milliseconds, rating) is supplied through stdin.
+song length in milliseconds, rating, album art url) is supplied through stdin.
Currently supported events are: artistbookmark, songban, songbookmark,
songexplain, songfinish, songlove, songmove, songshelf, songstart,
diff --git a/src/ui.c b/src/ui.c
index d115278..cef067d 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -599,6 +599,7 @@ void BarUiStartEventCmd (const BarSettings_t *settings, const char *type,
"artist=%s\n"
"title=%s\n"
"album=%s\n"
+ "coverArt=%s\n"
"stationName=%s\n"
"pRet=%i\n"
"pRetStr=%s\n"
@@ -610,6 +611,7 @@ void BarUiStartEventCmd (const BarSettings_t *settings, const char *type,
curSong == NULL ? "" : curSong->artist,
curSong == NULL ? "" : curSong->title,
curSong == NULL ? "" : curSong->album,
+ curSong == NULL ? "" : curSong->coverArt,
curStation == NULL ? "" : curStation->name,
pRet,
PianoErrorToStr (pRet),
diff --git a/src/ui_act.c b/src/ui_act.c
index 0f0cac2..35bc3ab 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -271,6 +271,7 @@ BarUiActCallback(BarUiActDebug) {
"artist:\t%s\n"
"audioFormat:\t%i\n"
"audioUrl:\t%s\n"
+ "coverArt:\t%s\n"
"fileGain:\t%f\n"
"musicId:\t%s\n"
"rating:\t%i\n"
@@ -280,7 +281,9 @@ BarUiActCallback(BarUiActDebug) {
"title:\t%s\n"
"userSeed:\t%s\n",
app->playlist->album, app->playlist->artist,
- app->playlist->audioFormat, app->playlist->audioUrl,
+ app->playlist->audioFormat,
+ app->playlist->audioUrl,
+ app->playlist->coverArt,
app->playlist->fileGain,
app->playlist->musicId, app->playlist->rating,
app->playlist->songType, app->playlist->stationId,