From: SuperBFG7 Date: Fri, 16 Oct 2015 13:31:29 +0000 (+0200) Subject: merge local_play X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=934fb63e1e3672ff8cdeaff226650a939b74244a;p=ympd.git merge local_play --- 934fb63e1e3672ff8cdeaff226650a939b74244a diff --cc htdocs/js/mpd.js index b30bd6c,e85192c..be1a8fa --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@@ -593,16 -575,45 +594,55 @@@ function clickPlay() socket.send('MPD_API_SET_PAUSE'); } +function renumber_table(tableID,item) { + was = item.children("td").first().text();//Check if first item exists! + is = item.index() + 1;//maybe add pagination + + if (was != is) { + socket.send("MPD_API_MOVE_TRACK," + was + "," + is); + socket.send('MPD_API_GET_QUEUE,'+pagination); + } +} + + function clickLocalPlay() { + var player = document.getElementById('player'); + $("#localplay-icon").removeClass("glyphicon-play").removeClass("glyphicon-pause"); + + if ( player.paused ) { + if ( $("#localstream").val() == "" ) { + $("#localstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); + $("#localplay-icon").addClass("glyphicon-play"); + getHost(); + return; + } + player.src = $("#localstream").val(); + console.log("playing mpd stream: " + player.src); + player.load(); + player.play(); + $("#localplay-icon").addClass("glyphicon-pause"); + } else { + player.pause(); + player.src=''; + player.removeAttribute("src"); + $("#localplay-icon").addClass("glyphicon-play"); + } + } + + function setLocalStream(mpdhost) { + if ( $("#localstream").val() != "" ) + return; + + var mpdstream = "http://"; + if ( mpdhost == "127.0.0.1" ) + mpdstream += window.location.hostname; + else + mpdstream += mpdhost; + mpdstream += ":8000/"; + $("#mpdstream").val(mpdstream); + $("#localstream").val(mpdstream); + $("#localstream").change(); + } + function basename(path) { return path.split('/').reverse()[0]; }