summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-10 12:09:08 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-06-10 12:09:08 +0200
commitf9bc1869e6fcba8f681d38dffa51661a3d87b005 (patch)
tree36fc7325f1b4fa603ee7f6c03c217ab30f46c943 /libpiano
parent941d4f27ef5337c5be5553f93e41aed7745c71e1 (diff)
downloadpianobar-windows-f9bc1869e6fcba8f681d38dffa51661a3d87b005.tar.gz
pianobar-windows-f9bc1869e6fcba8f681d38dffa51661a3d87b005.tar.bz2
pianobar-windows-f9bc1869e6fcba8f681d38dffa51661a3d87b005.zip
Get rating from playlist
Diffstat (limited to 'libpiano')
-rw-r--r--libpiano/piano.h9
-rw-r--r--libpiano/xml.c6
2 files changed, 10 insertions, 5 deletions
diff --git a/libpiano/piano.h b/libpiano/piano.h
index 5048dc0..b5d14ba 100644
--- a/libpiano/piano.h
+++ b/libpiano/piano.h
@@ -65,9 +65,11 @@ struct PianoStation {
char *id;
struct PianoStation *next;
};
-
typedef struct PianoStation PianoStation_t;
+enum PianoSongRating {PIANO_RATE_BAN, PIANO_RATE_LOVE, PIANO_RATE_NONE};
+typedef enum PianoSongRating PianoSongRating_t;
+
struct PianoSong {
char *artist;
char **genre;
@@ -82,7 +84,7 @@ struct PianoSong {
char *webId;
/* disabled: musicComUrl */
/* disabled: fanExplorerUrl */
- int rating;
+ PianoSongRating_t rating;
/* disabled: artistExplorerUrl */
/* disabled: artRadio */
char *audioEncoding; /* FIXME: should be enum: mp3 or aacplus */
@@ -119,9 +121,6 @@ typedef struct PianoHandle PianoHandle_t;
enum PianoReturn {PIANO_RET_OK, PIANO_RET_ERR};
typedef enum PianoReturn PianoReturn_t;
-enum PianoSongRating {PIANO_RATE_BAN, PIANO_RATE_LOVE};
-typedef enum PianoSongRating PianoSongRating_t;
-
void PianoInit (PianoHandle_t *);
void PianoDestroy (PianoHandle_t *);
void PianoDestroyPlaylist (PianoHandle_t *ph);
diff --git a/libpiano/xml.c b/libpiano/xml.c
index 8881ac9..ba6e3c8 100644
--- a/libpiano/xml.c
+++ b/libpiano/xml.c
@@ -167,6 +167,12 @@ void PianoXmlParsePlaylistCb (char *key, xmlNode *value, void *data) {
song->focusTraitId = strdup (valueStr);
} else if (strcmp ("songTitle", key) == 0) {
song->title = strdup (valueStr);
+ } else if (strcmp ("rating", key) == 0) {
+ if (xmlStrEqual (valueStr, "1")) {
+ song->rating = PIANO_RATE_LOVE;
+ } else {
+ song->rating = PIANO_RATE_NONE;
+ }
}
}