summaryrefslogtreecommitdiff
path: root/libpiano
diff options
context:
space:
mode:
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;
+ }
}
}