.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 .014 multiple api call issue fix
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...)
- Jukebox Control
- Download Links
- Ratings
- Chrome App???
- Add notification when trial license has expired
- Chrome App???

View file

@ -41,21 +41,36 @@ function loadArtists(refresh) {
req.setRequestHeader('Authorization', auth);
},
success: function (data) {
var indexlist;
$.each(data["subsonic-response"].indexes.index, function (i, index) {
$('<li class=\"index\" id=\"index_' + index.name + '\">' + index.name + '<a href=\"#\" class=\"indextop floatright\">&uarr;</a></li>').appendTo("#ArtistContainer");
indexlist += '<li><a href=\"#\">' + index.name + '</a></li>';
$.each(index.artist, 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");
if (data["subsonic-response"].status == 'ok') {
var indexlist;
$.each(data["subsonic-response"].indexes.index, function (i, index) {
$('<li class=\"index\" id=\"index_' + index.name + '\">' + index.name + '<a href=\"#\" class=\"indextop floatright\">&uarr;</a></li>').appendTo("#ArtistContainer");
indexlist += '<li><a href=\"#\">' + index.name + '</a></li>';
var artists = [];
if (index.artist.length > 0) {
artists = index.artist;
} else {
artists[0] = index.artist;
}
$.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");
}
}
});
}