add artist and title columns (by laclaro)
authorSuperBFG7 <daniel@despite.ch>
Fri, 16 Oct 2015 16:51:25 +0000 (18:51 +0200)
committerSuperBFG7 <daniel@despite.ch>
Fri, 16 Oct 2015 16:51:25 +0000 (18:51 +0200)
1  2 
htdocs/index.html
htdocs/js/mpd.js
src/mpd_client.c

Simple merge
@@@ -280,17 -192,19 +283,17 @@@ function webSocketConnect() 
                          switch(obj.data[item].type) {
                              case "directory":
                                  $('#salamisandwich > tbody').append(
 -                                    "<tr uri=\"" + obj.data[item].dir + "\" class=\"dir\">" +
 +                                    "<tr uri=\"" + encodeURI(obj.data[item].dir) + "\" class=\"dir\">" +
-                                     "<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" +
-                                     "<td><a>" + basename(obj.data[item].dir) + "</a></td>" +
+                                     "<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" + 
+                                     "<td><a>" + basename(obj.data[item].dir) + "</a></td>" + 
+                                     "<td></td><td></td>" +
                                      "<td></td><td></td></tr>"
                                  );
                                  break;
                              case "playlist":
                                  $('#salamisandwich > tbody').append(
 -                                    "<tr uri=\"" + obj.data[item].plist + "\" class=\"plist\">" +
 -                                    "<td><span class=\"glyphicon glyphicon-list\"></span></td>" + 
 -                                    "<td><a>" + basename(obj.data[item].plist) + "</a></td>" +
 +                                    "<tr uri=\"" + encodeURI(obj.data[item].plist) + "\" class=\"plist\">" +
-                                     "<td><span class=\"glyphicon glyphicon-list\"></span></td>" +
-                                     "<td><a>" + basename(obj.data[item].plist) + "</a></td>" +
+                                     "<td></td><td></td>" +
                                      "<td></td><td></td></tr>"
                                  );
                                  break;
                                  var seconds = obj.data[item].duration - minutes * 60;
  
                                  $('#salamisandwich > tbody').append(
 -                                    "<tr uri=\"" + obj.data[item].uri + "\" class=\"song\">" +
 +                                    "<tr uri=\"" + encodeURI(obj.data[item].uri) + "\" class=\"song\">" +
-                                     "<td><span class=\"glyphicon glyphicon-music\"></span></td>" +
-                                     "<td>" + obj.data[item].title +"</td>" +
-                                     "<td>"+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds +
+                                     "<td><span class=\"glyphicon glyphicon-music\"></span></td>" + 
+                                     "<td>" + obj.data[item].title  + "</td>" +
+                                     "<td>" + obj.data[item].album  + "</td>" +
+                                     "<td>" + obj.data[item].artist + "</td>" + 
+                                     "<td>" + minutes + ":" + (seconds < 10 ? '0' : '') + seconds +
                                      "</td><td></td></tr>"
                                  );
                                  break;
@@@ -424,6 -320,42 +424,42 @@@ char* mpd_get_title(struct mpd_song con
      return str;
  }
  
 -        str = basename((char *)mpd_song_get_uri(song));
+ 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 = "-";
+     }
+     return str;
+ }
  int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
  {
      struct mpd_status *status;