Revert some changes: There's no need to print the artist/album for each song while...
authoreb041592 <35889760+eb041592@users.noreply.github.com>
Wed, 4 Apr 2018 22:59:39 +0000 (00:59 +0200)
committereb041592 <35889760+eb041592@users.noreply.github.com>
Wed, 4 Apr 2018 22:59:39 +0000 (00:59 +0200)
htdocs/js/mpd.js

index ef1ad1d..13fd4e4 100644 (file)
@@ -364,17 +364,17 @@ function webSocketConnect() {
                                 var minutes = Math.floor(obj.data[item].duration / 60);
                                 var seconds = obj.data[item].duration - minutes * 60;
 
-//                                if (typeof obj.data[item].artist === 'undefined') {
-//                                    var details = "<td colspan=\"2\">" + obj.data[item].title + "</td>";
-//                                } else {
-//                                    var details = "<td>" + obj.data[item].artist + "<span>" + obj.data[item].album + "</span></td><td>" + obj.data[item].title + "</td>";
-//                                }
+                                if (obj.data[item].artist == null) {
+                                    var artist = "<td colspan=\"2\">";
+                                } else {
+                                    var artist = "<td>" + obj.data[item].artist +
+                                                     "<span>" + obj.data[item].album + "</span></td><td>";
+                                }
 
                                 $('#salamisandwich > tbody').append(
                                     "<tr uri=\"" + encodeURI(obj.data[item].uri) + "\" class=\"song\">" +
                                     "<td><span class=\"glyphicon glyphicon-music\"></span></td>" +
-                                    "<td>" + obj.data[song].artist + "<span>" + obj.data[song].album + "</span></td>" +
-                                    "<td>" + obj.data[song].title + "</td>" +
+                                    artist + obj.data[item].title + "</td>" +
                                     "<td>" + minutes + ":" + (seconds < 10 ? '0' : '') + seconds +
                                     "</td><td></td></tr>"
                                 );