From d5101556717b147e8fb0b93b32fc6f509730b7a1 Mon Sep 17 00:00:00 2001 From: Wouter van Wijk Date: Wed, 18 Sep 2013 21:11:14 +0200 Subject: [PATCH] quick fix for soundcloud, sortof --- webclient/js/functionsvars.js | 21 ++++++++++++--------- webclient/js/library.js | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/webclient/js/functionsvars.js b/webclient/js/functionsvars.js index 41f8421..be5543f 100755 --- a/webclient/js/functionsvars.js +++ b/webclient/js/functionsvars.js @@ -153,6 +153,7 @@ function resultsToTables(results, target, uri) { var tableid, j, artistname, alburi; var targetmin = target.substr(1); $(target).attr('data', uri); +// console.log(results); var length = 0 || results.length; for ( i = 0; i < length; i++) { newalbum.push(results[i]); @@ -194,15 +195,17 @@ function resultsToTables(results, target, uri) { } else { html += '
  • '; html += '

    ' + results[i].album.name + '

    '; - for ( j = 0; j < results[i].album.artists.length; j++) { - html += results[i].album.artists[j].name; - html += (j == results[i].album.artists.length - 1) ? '' : ' / '; - //stop after 3 - if (j > 2) { - child += '...'; - break; - } - } + if (results[i].album.artists) { + for ( j = 0; j < results[i].album.artists.length; j++) { + html += results[i].album.artists[j].name; + html += (j == results[i].album.artists.length - 1) ? '' : ' / '; + //stop after 3 + if (j > 2) { + child += '...'; + break; + } + } + } html += '

  • '; for ( j = 0; j < newalbum.length; j++) { popupData[newalbum[j].uri] = newalbum[j]; diff --git a/webclient/js/library.js b/webclient/js/library.js index 29814d8..8cc50d5 100755 --- a/webclient/js/library.js +++ b/webclient/js/library.js @@ -166,6 +166,7 @@ function showTracklist(uri) { $('#playlisttracksdiv').show(); var pl = getPlaylistFromUri(uri); + console.log(uri, pl); //load from cache if (pl) { resultsToTables(pl.tracks, PLAYLIST_TABLE, uri);