I have a problem when using this spotify playlist spotify:user:juan20150:playlist:5rl5QaWjWtEPv9a057w3qc
This is the first playlist I've seen which has this problem. The snapshot length returned is 290, but when I do snapshot.loadAll, it returns only 289 tracks.
Any idea why it would happen?
var playlist = models.Playlist.fromURI("spotify:user:juan20150:playlist:5rl5QaWjWtEPv9a057w3qc");
playlist.load('tracks').done(function() {
playlist.tracks.snapshot().done(function(snapshot) {
console.log("snapshot length " , snapshot.length);
$i=0;
snapshot.loadAll('name').each(function(track) {
console.log("i=" , i++);
});
});
});
Results:
snapshot length 290 i = 289 (at the end)
Thanks
Because you started at zero, and post-incremented. If the playlist was length 3, it would print
for the 3 tracks.
Update trying it myself To start with, it helps to put actual code not pseudo code. I threw your code in my app and it didn't work. Once I fixed it, it printed from 0 to 288. So, I removed
.each
and put in.done
and it didn't print anything. However,.fail
did return something. Unfortunately, the error is undefined. The below:outputs:
My best guess is that you have a song in there that is no longer accessible (licensing dispute or something).