merge local_play
authorSuperBFG7 <daniel@despite.ch>
Fri, 16 Oct 2015 13:31:29 +0000 (15:31 +0200)
committerSuperBFG7 <daniel@despite.ch>
Fri, 16 Oct 2015 13:31:29 +0000 (15:31 +0200)
1  2 
htdocs/index.html
htdocs/js/mpd.js

Simple merge
@@@ -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];
  }