From 240be7dc9add2cc3bda8f80ec21b3b4e97cfaf49 Mon Sep 17 00:00:00 2001 From: woutervanwijk Date: Sat, 8 Mar 2014 00:37:44 +0100 Subject: [PATCH] small changes --- webclient/js/controls.js | 1 - webclient/js/functionsvars.js | 21 +++++++++++++++------ webclient/js/gui.js | 14 ++++++-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/webclient/js/controls.js b/webclient/js/controls.js index d3382f6..2b3e28f 100755 --- a/webclient/js/controls.js +++ b/webclient/js/controls.js @@ -11,7 +11,6 @@ function playBrowsedTracks(addtoqueue, trackid) { var selected = 0, counter = 0; //only add one station for dirble, otherwise add all tracks if (isRadioUri(trackid)) { - alert(trackid); mopidy.tracklist.add(null, null, trackid); } else { //add all items in the playlist diff --git a/webclient/js/functionsvars.js b/webclient/js/functionsvars.js index 8f0b249..b04a961 100755 --- a/webclient/js/functionsvars.js +++ b/webclient/js/functionsvars.js @@ -150,11 +150,18 @@ function albumTracksToTable(pl, target, uri) { } function renderSongLi(song, liID, uri, playlistType){ + var name; + if (!song.name || song.name == '') { + name = data.uri.split('/'); + name = decodeURI(name[name.length - 1]); + } else { + name = song.name; + } songLi = '
  • ' + '' + '' + '' +'' + - '

    '+song.name+'

    ' + + '

    '+ name + '

    ' + '
    ' + '
  • '; @@ -188,14 +195,13 @@ function resultsToTables(results, target, uri) { if (i < length - 1) { nexturi = results[i + 1].album.uri; } -//console.log(results[i]); if (!results[i].album || (results[i].length == -1)) { var name = results[i].name || results[i].uri; html += '
  • ' + name + ' [Stream]

  • '; newalbum = []; nexturi = ''; } else { - if (results[i].album.uri != nexturi) { + if (results[i].album.uri && (results[i].album.uri != nexturi)) { tableid = 'art' + i; //render differently if only one track in the album if ( newalbum.length == 1 ) { @@ -226,9 +232,12 @@ function resultsToTables(results, target, uri) { newalbum = []; } else { - html += '
  • '; - html += '

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

    '; + if ( results[i].album.uri && results[i].album.name) { + html += '

  • '; + html += '

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

    '; + } +console.log(i); if (results[i].album.artists) { for (j = 0; j < results[i].album.artists.length; j++) { html += results[i].album.artists[j].name; diff --git a/webclient/js/gui.js b/webclient/js/gui.js index 5906fc5..3cf184f 100755 --- a/webclient/js/gui.js +++ b/webclient/js/gui.js @@ -77,11 +77,11 @@ function resizeMb() { } function setSongInfo(data) { - if (!data || (songdata == data) ) { return; } - if (data.name == '') { -// data.name = data.uri; - return; + if (!data.name || data.name == '') { + var name = data.uri.split('/'); + data.name = decodeURI(name[name.length - 1]); }; + if (!data || (songdata == data) ) { return; } //update styles of listviews $('#currenttable li').each(function() { @@ -118,9 +118,6 @@ function setSongInfo(data) { }); - if (data.name && (songdata.name == data.name)) { - return; - } songdata = data; artistshtml = ''; artiststext = ''; @@ -133,6 +130,7 @@ function setSongInfo(data) { } }; } + console.log(data); $("#modalname").html(data.name); @@ -163,7 +161,7 @@ function setSongInfo(data) { arttmp = artistshtml; } - if (data.album) { + if (data.album && data.album.name) { $("#modalalbum").html('' + data.album.name + ''); getCover(artiststext, data.album.name, '#infocover, #controlspopupimage', 'extralarge'); } else {