I’m making a prototype Spotify Application, and I am stuck on the last part of code.
I have a list of albums URI, and want to display an album with cover and link to it. So I parse the list, create an album object, and push the HTML corresponding to what I want.
It look like this:
for(var i = data.length; i--; ) {
var cd = models.Album.fromURI(data[i].uri);
var cover = $(document.createElement('div')).attr('id', 'player-image');
cover.append($(document.createElement('a')).attr('href', data[i].uri));
var img = new ui.SPImage(cd.cover ? cd.cover : "sp://import/img/placeholders/300-album.png");
cover.children().append(img.node);
$("#discs").append(cover);
}
I don’t understand why cd.cover is always empty.
Looks like the documentation is incorrect. Instead of using the cover property use image from the track or album object.