Permalink
Browse files

Merge branch 'master' of https://github.com/mklauber/MPD-Web-Remote i…

…nto tswaehn
  • Loading branch information...
2 parents ef906d0 + 84efd0b commit 77728c5a5ae836179734efc8573db6fff7bab668 @tswaehn tswaehn committed Jan 24, 2012
Showing with 100 additions and 21 deletions.
  1. +19 −1 css/style.css
  2. +21 −11 index.php
  3. +46 −5 javascript/remoteFunctions.js
  4. +9 −4 mpd/mpdcontrol.php
  5. +5 −0 showSongs.php
View
@@ -38,7 +38,7 @@
background: url("../images/next.png") no-repeat 0 0;
}
-#buttonWrapper
+.buttonWrapper
{
/*position: absolute;
top: 385px;*/
@@ -114,3 +114,21 @@
{
background-image: url('../images/SpeakerIcon.png');
}
+
+#bottombar {
+ position:fixed;
+ bottom:0px;
+ z-index: 1;
+}
+
+#topbar {
+ position:fixed;
+ top:0px;
+ width:100%;
+ z-index: 1;
+
+}
+#content {
+ padding-top:44px;
+ padding-bottom:48px;
+
View
@@ -58,29 +58,39 @@
<ul class="pageitem">
<li class="checkbox"><span class="name">Random</span><input id="shuffleCheckbox" type="checkbox" /></li>
+ <li class="checkbox"><span class="name">Repeat</span><input id="repeatCheckbox" type="checkbox" /></li>
</ul>
<ul class="pageitem">
+ <li class="menu" id="volumeUp">
+ <span class="name">Volume Up</span>
+ </li>
+ <li class="menu" id="volumeDown">
+ <span class="name">Volume Down</span>
+ </li>
+ </ul>
+
+ <ul class="pageitem">
<li class="menu">
<a href="playqueue.html">
<span class="name">Play Queue</span>
<span class="comment" id="playqueueCount"></span>
<span class="arrow"></span>
</a>
</li>
- </ul>
-
- <div id="buttonWrapper">
- <div id="buttonHolder">
- <span id="previousButton"></span>
- <span id="playPauseButton" class="play"></span>
- <span id="nextButton"></span>
- </div>
- <div id="buttonBackgroundFiller"></div>
- </div>
-
+ </ul>
</div> <!-- inner content; don't display if we can't connect to mpd -->
</div>
+
+ <div id="bottombar" class="buttonWrapper">
+ <div id="buttonHolder">
+ <span id="previousButton"></span>
+ <span id="playPauseButton" class="play"></span>
+ <span id="nextButton"></span>
+ </div>
+ <div id="buttonBackgroundFiller"></div>
+ </div>
+
<div id="footer">
<a class="noeffect" href="http://iwebkit.net">Thanks to iWebKit for all the style sheets.</a>
@@ -10,15 +10,21 @@ var addEventListeners = function()
{
var lastUpdated = document.getElementById("lastUpdated");
var shuffleCheckbox = document.getElementById("shuffleCheckbox");
+ var repeatCheckbox = document.getElementById("repeatCheckbox");
var previousButton = document.getElementById("previousButton");
var playPauseButton = document.getElementById("playPauseButton");
var nextButton = document.getElementById("nextButton");
+ var volUpButton = document.getElementById("volumeUp");
+ var volDownButton = document.getElementById("volumeDown");
lastUpdated.addEventListener("click", updatePage, false);
shuffleCheckbox.addEventListener("click", toggleRandom, false);
previousButton.addEventListener("click", previous, false);
playPauseButton.addEventListener("click", playPause, false);
nextButton.addEventListener("click", next, false);
+ volUpButton.addEventListener("click", volumeUp, false);
+ volDownButton.addEventListener("click", volumeDown, false);
+ repeatCheckbox.addEventListener("click", toggleRepeat, false);
}
var status = "stop";
@@ -52,10 +58,11 @@ var updatePage = function()
status = serverResponseLine[0];
var randomStatus = serverResponseLine[1];
- var playqueueCount = serverResponseLine[2];
- var track = serverResponseLine[3];
- var artist = serverResponseLine[4];
- var album = serverResponseLine[5];
+ var repeatStatus = serverResponseLine[2];
+ var playqueueCount = serverResponseLine[3];
+ var track = serverResponseLine[4];
+ var artist = serverResponseLine[5];
+ var album = serverResponseLine[6];
if (status == "stop")
{
@@ -96,7 +103,8 @@ var updatePage = function()
theTime.getSeconds() + "s";
document.getElementById("shuffleCheckbox").checked = (randomStatus == 1)?true:false;
-
+ document.getElementById("repeatCheckbox").checked = (repeatStatus == 1)?true:false;
+
document.getElementById("playqueueCount").innerHTML = "Tracks: " + playqueueCount;
var playPauseButton = document.getElementById("playPauseButton");
@@ -187,3 +195,36 @@ var toggleRandom = function()
}
updatePage();
}
+
+var toggleRepeat = function()
+{
+ var turnRepeatOn = document.getElementById("repeatCheckbox").checked;
+
+ if (turnRepeatOn)
+ {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", mpdControlFile + "?action=RepeatOn", false);
+ xmlhttp.send();
+ }
+ else
+ {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", mpdControlFile + "?action=RepeatOff", false);
+ xmlhttp.send();
+ }
+ updatePage();
+}
+
+var volumeUp = function()
+{
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", mpdControlFile + "?action=VolumeUp", false);
+ xmlhttp.send();
+}
+
+var volumeDown = function()
+{
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", mpdControlFile + "?action=VolumeDown", false);
+ xmlhttp.send();
+}
View
@@ -37,24 +37,29 @@
case "SkipTo": $mpd->SkipTo($track); break;
case "RandomOn": $mpd->SetRandom(1); break;
case "RandomOff": $mpd->SetRandom(0); break;
+ case "RepeatOn": $mpd->SetRepeat(1); break;
+ case "RepeatOff": $mpd->SetRepeat(0); break;
+ case "VolumeUp": $mpd->AdjustVolume(5); break;
+ case "VolumeDown": $mpd->AdjustVolume(-5); break;
case "AddToPlayQueue": $mpd->PLAdd($track); break;
case "ClearPlayQueue": $mpd->PLClear(); break;
case "AddAllTracksToPlayQueue": addAllTracks($mpd); break;
-
+
case "AddAllTracksInPlaylistToPlayQueue": /* lol */
addAllTracksInPlaylist($_GET['playlist'], $mpd);
break;
-
+
case "AddAllTracksFromSearchToPlayQueue":
addAllTracksInSearch($_GET['searchText'], $mpd);
break;
-
+
default: break;
}
-// Print MPD's information
+// Print MPD's information
echo $mpd->state."\n";
echo $mpd->random."\n";
+echo $mpd->repeat."\n";
echo $mpd->playlist_count."\n";
if ($mpd->state != "stop")
View
@@ -28,6 +28,11 @@
<meta name="mode" id="mode" content="<?php if (isset($_GET['mode'])) echo $_GET['mode']; ?>" />
<meta name="playlistName" id="playlistName" content="<?php if (isset($_GET['playlist'])) echo $_GET['playlist']; ?>" />
<meta name="searchText" id="searchText" content="<?php if (isset($_GET['searchText'])) echo $_GET['searchText']; ?>" />
+ <style>
+ #trackList li {
+ overflow:hidden;
+ }
+ </style>
</head>
<body class="musiclist">

0 comments on commit 77728c5

Please sign in to comment.