function addRestoredSongs(playlist, songIndex) { var restoredSong = playlist.songs[songIndex]; if (restoredSong) { soundCloudService.getSong(restoredSong.permaLinkUrl).then(function (song) { song.votes = restoredSong.votes; return enhancedPlayer.add(song); }).then(function () { var nextSongIndex = songIndex + 1; addRestoredSongs(playlist, nextSongIndex); }).done(); } }
function add(url) { soundCloudService.getSong(url).then(function (song) { enhancedPlayer.add(song); }).done(); }