.016 single artist bug fix, added API error notification

This commit is contained in:
Trevor Squillario 2011-11-22 10:25:51 -05:00
parent 73b5d8ccf9
commit c5adc3984b
2 changed files with 30 additions and 15 deletions

4
README
View file

@ -15,10 +15,10 @@ External Subsonic Music Player
10/14/2011 .013 moved auto playlists, album display tweaks 10/14/2011 .013 moved auto playlists, album display tweaks
10/14/2011 .014 multiple api call issue fix 10/14/2011 .014 multiple api call issue fix
11/15/2011 .015 fixed search issue, added last.fm support from smrq 11/15/2011 .015 fixed search issue, added last.fm support from smrq
11/22/2011 .016 single artist bug fix, added API error notification
TO DO: (In no particular order...) TO DO: (In no particular order...)
- Jukebox Control - Jukebox Control
- Download Links - Download Links
- Ratings - Ratings
- Chrome App??? - Chrome App???
- Add notification when trial license has expired

View file

@ -41,21 +41,36 @@ function loadArtists(refresh) {
req.setRequestHeader('Authorization', auth); req.setRequestHeader('Authorization', auth);
}, },
success: function (data) { success: function (data) {
var indexlist; if (data["subsonic-response"].status == 'ok') {
$.each(data["subsonic-response"].indexes.index, function (i, index) { var indexlist;
$('<li class=\"index\" id=\"index_' + index.name + '\">' + index.name + '<a href=\"#\" class=\"indextop floatright\">&uarr;</a></li>').appendTo("#ArtistContainer"); $.each(data["subsonic-response"].indexes.index, function (i, index) {
indexlist += '<li><a href=\"#\">' + index.name + '</a></li>'; $('<li class=\"index\" id=\"index_' + index.name + '\">' + index.name + '<a href=\"#\" class=\"indextop floatright\">&uarr;</a></li>').appendTo("#ArtistContainer");
$.each(index.artist, function (i, artist) { indexlist += '<li><a href=\"#\">' + index.name + '</a></li>';
if (artist.name != undefined) { var artists = [];
var html = ""; if (index.artist.length > 0) {
html += '<li id=\"' + artist.id + '\" class=\"item\">'; artists = index.artist;
html += '<span>' + artist.name + '</span>'; } else {
html += '</li>'; artists[0] = index.artist;
$(html).appendTo("#ArtistContainer");
} }
$.each(artists, function (i, artist) {
if (artist.name != undefined) {
var html = "";
html += '<li id=\"' + artist.id + '\" class=\"item\">';
html += '<span>' + artist.name + '</span>';
html += '</li>';
$(html).appendTo("#ArtistContainer");
}
});
}); });
}); $(indexlist).appendTo("#IndexList");
$(indexlist).appendTo("#IndexList"); } else {
var error = data["subsonic-response"].status;
var errorcode = data["subsonic-response"].error.code;
var errormsg = data["subsonic-response"].error.message;
alert('Status: ' + error + ', Code: ' + errorcode + ', Message: ' + errormsg);
//var errorhtml = '<li class=\"item\"><span>' + error + '</span></li>';
//$(errorhtml).appendTo("#IndexList");
}
} }
}); });
} }