/** * @author Wouter van Wijk * * these functions communication with ws server * */ /******************************************************** * process results of a (new) currently playing track *********************************************************/ function processCurrenttrack(data) { setSongInfo(data); } /******************************************************** * process results of volume *********************************************************/ function processVolume(data) { if (!volumeChanging) { setVolume(data); } } /******************************************************** * process results of a repeat *********************************************************/ function processRepeat(data) { setRepeat(data); } /******************************************************** * process results of random *********************************************************/ function processRandom(data) { setRandom(data); } /******************************************************** * process results of consume *********************************************************/ function processConsume(data) { setConsume(data); } /******************************************************** * process results of single *********************************************************/ function processSingle(data) { setSingle(data); } /******************************************************** * process results of current position *********************************************************/ function processCurrentposition(data) { var pos = parseInt(data); setPosition(pos); } /******************************************************** * process results playstate *********************************************************/ function processPlaystate(data) { if (data == 'playing') { setPlayState(true); resumePosTimer(); } else { setPlayState(false); } } /******************************************************** * process results of a browse list *********************************************************/ function processBrowseDir(resultArr) { var backHtml = '
  • Back

  • ' if ( (!resultArr) || (resultArr == '') || (resultArr.length == 0) ) { $('#browsepath').html('No tracks found...'); $('#browselist').html(backHtml); showLoading(false); return; } $('#browselist').empty(); var child = "", rooturi = "", uri = resultArr[0].uri; //check root uri //find last : or / (spltting the result) //do it twice, since. var colonindex = uri.lastIndexOf(':'); var slashindex = uri.lastIndexOf('/'); var lastindex = (colonindex > slashindex) ? colonindex : slashindex; rooturi = uri.slice(0, lastindex); if (resultArr[0].type == 'track' ) { rooturi = rooturi.replace(":track:", ":directory:"); } colonindex = rooturi.lastIndexOf(':'); slashindex = rooturi.lastIndexOf('/'); lastindex = (colonindex > slashindex) ? colonindex : slashindex; rooturi = rooturi.slice(0, lastindex); if (browseStack.length > 0) { child += backHtml; } for (var i = 0; i < resultArr.length; i++) { iconClass = getMediaClass(resultArr[i].uri); if(resultArr[i].type == 'track' ) { // console.log(resultArr[i]); child += '
  • ' + resultArr[i].name + '

  • '; } else { if (browseStack.length > 0) { iconClass="fa fa-folder-o"; } child += '
  • ' + resultArr[i].name + '

  • '; } }; $('#browselist').html(child); if (browseStack.length > 0 ) { /* child = ''; for (var i = 0; i < browseStack.length; i++) { child += browseStack[i] + ' / '; } child = getMediaHuman(browseStack[0]); iconClass = getMediaClass(browseStack[0]); */ child = getMediaHuman(resultArr[0].uri); iconClass = getMediaClass(resultArr[0].uri); $('#browsepath').html(' ' + child); } else { $('#browsepath').html(''); } updatePlayIcons(songdata.uri); showLoading(false); } /******************************************************** * process results of list of playlists of the user *********************************************************/ function processGetPlaylists(resultArr) { /*