Browse Source

basic radio functionality working

master
Sean Clarke 2 years ago
commit
498bc3f232
  1. 0
      README.md
  2. 31
      index.html
  3. 23
      radio.php

0
README.md

31
index.html

@ -0,0 +1,31 @@
<html>
<script type="text/javascript" src="jquery-3.4.1.min.js"></script>
<style>
a {
}
</style>
<a href='#' onclick="radio(1);">Seanland's Game Music</a>
<a href='#' onclick="radio(2);">Seanland's Top 100s</a>
<a href='#' onclick="radio(3);">Seanland's Collection</a>
<a href='#' onclick="radio(stop);">Stop Music</a>
<script type='text/javascript'>
//AJAX function
function radio(com) {
$.ajax({
type: "POST",
url: "radio.php",
data: "radio=" + com,
success: function(msg){
// may add in the future
}
});
}
</script>
</html>

23
radio.php

@ -0,0 +1,23 @@
<?php
if (isset($_POST['radio'])) {
radioControl($_POST['radio']);
}
function radioControl($digit) {
switch ($digit) {
case '1':
shell_exec('mpc play 1');
break;
case '2':
shell_exec('mpc play 2');
break;
case '3':
shell_exec('mpc play 3');
break;
default:
shell_exec('mpc stop');
break;
}
}
?>
Loading…
Cancel
Save