Browse Source

basic radio functionality working

master
Sean Clarke 10 months ago
commit
498bc3f232
3 changed files with 54 additions and 0 deletions
  1. +0
    -0
      README.md
  2. +31
    -0
      index.html
  3. +23
    -0
      radio.php

+ 0
- 0
README.md View File


+ 31
- 0
index.html View File

@@ -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
- 0
radio.php View File

@@ -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