From: SuperBFG7 Date: Fri, 16 Oct 2015 16:51:25 +0000 (+0200) Subject: add artist and title columns (by laclaro) X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=ff92b2718ff44ebf17bebea8d0ce620699e779ad;p=ympd.git add artist and title columns (by laclaro) --- ff92b2718ff44ebf17bebea8d0ce620699e779ad diff --cc htdocs/js/mpd.js index be1a8fa,08e08a9..befb312 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@@ -280,17 -192,19 +283,17 @@@ function webSocketConnect() switch(obj.data[item].type) { case "directory": $('#salamisandwich > tbody').append( - "" + + "" + - "" + - "" + basename(obj.data[item].dir) + "" + + "" + + "" + basename(obj.data[item].dir) + "" + + "" + "" ); break; case "playlist": $('#salamisandwich > tbody').append( - "" + - "" + - "" + basename(obj.data[item].plist) + "" + + "" + - "" + - "" + basename(obj.data[item].plist) + "" + + "" + "" ); break; @@@ -299,10 -213,12 +302,12 @@@ var seconds = obj.data[item].duration - minutes * 60; $('#salamisandwich > tbody').append( - "" + + "" + - "" + - "" + obj.data[item].title +"" + - ""+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds + + "" + + "" + obj.data[item].title + "" + + "" + obj.data[item].album + "" + + "" + obj.data[item].artist + "" + + "" + minutes + ":" + (seconds < 10 ? '0' : '') + seconds + "" ); break; diff --cc src/mpd_client.c index c90436d,2fcc16f..f9fd6b6 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@@ -424,6 -320,42 +424,42 @@@ char* mpd_get_title(struct mpd_song con return str; } + char* mpd_get_album(struct mpd_song const *song) + { + char *str; + + str = (char *)mpd_song_get_tag(song, MPD_TAG_ALBUM, 0); + if(str == NULL){ - str = basename((char *)mpd_song_get_uri(song)); ++ str = "-"; + } + + return str; + } + + char* mpd_get_artist(struct mpd_song const *song) + { + char *str; + + str = (char *)mpd_song_get_tag(song, MPD_TAG_ARTIST, 0); + if(str == NULL){ - str = basename((char *)mpd_song_get_uri(song)); ++ str = "-"; + } + + 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)); ++ str = "-"; + } + + return str; + } + int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version) { struct mpd_status *status;