Fix for songs with empty tags not being displayed in the web UI.

This commit is contained in:
Anders Betnér 2005-03-06 09:29:48 +00:00
parent ab681005c9
commit cbc3ddf143

View File

@ -99,13 +99,29 @@ function playlistSelect(event) {
items = g_req.responseXML.getElementsByTagName('dmap.listingitem'); items = g_req.responseXML.getElementsByTagName('dmap.listingitem');
for (i=0; i < items.length; i++) { for (i=0; i < items.length; i++) {
song = items[i].getElementsByTagName('dmap.itemname').item(0).textContent; // Have to check if the tag really was returned from the server
if (song = items[i].getElementsByTagName('dmap.itemname').item(0)) {
song = song.textContent;
} else {
song = '';
}
time = ''; //items[i].getElementsByTagName('daap.songtime').item(0).textContent; time = ''; //items[i].getElementsByTagName('daap.songtime').item(0).textContent;
artist = items[i].getElementsByTagName('daap.songartist').item(0).textContent; if (artist = items[i].getElementsByTagName('daap.songartist').item(0)) {
album = items[i].getElementsByTagName('daap.songalbum').item(0).textContent; artist = artist.textContent;
genre = items[i].getElementsByTagName('daap.songgenre').item(0).textContent; } else {
artist = '';
}
if (album = items[i].getElementsByTagName('daap.songalbum').item(0)) {
album = album.textContent;
} else {
album = '';
}
if (genre = items[i].getElementsByTagName('daap.songgenre').item(0)) {
genre = genre.textContent;
} else {
genre = '';
}
addRow(tableBody,song,time,artist,album,genre); addRow(tableBody,song,time,artist,album,genre);
} }