return str;
}
+char* mpd_get_year(struct mpd_song const *song)
+{
+ char *str;
+
+ str = (char *)mpd_song_get_tag(song, MPD_TAG_DATE, 0);
+ if(str == NULL){
+ str = basename((char *)mpd_song_get_uri(song));
+ }
+
+ return str;
+}
+
int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
{
struct mpd_status *status;
song = mpd_entity_get_song(entity);
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
- cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
- cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
- cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
- cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
+ cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
+ cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
+ cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
+ cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song));
cur += json_emit_raw_str(cur, end - cur, "},");
while((song = mpd_recv_song(mpd.conn)) != NULL) {
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
+ cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
+ cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
+ cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
+ cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");