Created
February 13, 2016 11:49
-
-
Save oyakodon/feb99fd9ce9646767016 to your computer and use it in GitHub Desktop.
ラジオをブラウザから操作する / php & html & jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$content=""; | |
if(isset($_GET["id"])){ | |
$id = $_GET["id"]; | |
switch ($id) { | |
case "stop": | |
exec("nohup /usr/bin/killall mplayer > /dev/null &"); | |
$content="再生を停止しました。"; | |
break; | |
case "one": | |
exec("nohup /usr/bin/killall mplayer > /dev/null &"); | |
exec("nohup /bin/bash rajiru.sh -p NHK1_SENDAI > /dev/null &", $e); | |
$content="再生を開始しました。"; | |
break; | |
case "two": | |
exec("nohup /usr/bin/killall mplayer > /dev/null &"); | |
exec("nohup /bin/bash rajiru.sh -p NHK2 > /dev/null &", $e); | |
$content="再生を開始しました。"; | |
break; | |
case "fm": | |
exec("nohup /usr/bin/killall mplayer > /dev/null &"); | |
exec("nohup /bin/bash rajiru.sh -p FM_SENDAI > /dev/null &", $e); | |
$content="再生を開始しました。"; | |
break; | |
case "tbc": | |
exec("nohup /usr/bin/killall mplayer > /dev/null &"); | |
exec("nohup /bin/bash radiko.sh -p TBC > /dev/null &"); | |
$content="再生を開始しました。"; | |
break; | |
case "check": | |
$ret = exec("ps ax | grep -v grep | grep mplayer"); | |
if(empty($ret)) { | |
$content="状況:[停止]"; | |
} else { | |
$content="状況:[再生中]"; | |
} | |
break; | |
default: | |
$content="エラー"; | |
break; | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>RasPi Radio Player</title> | |
<link rel="stylesheet" | |
href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"> | |
</script> | |
<style type="text/css"> | |
<!-- | |
#header { | |
background-color: #008080; color: #FFFFFF; | |
} | |
.ui-header .ui-title { | |
margin-left: 15%; | |
margin-right: 15% | |
} | |
--> | |
</style> | |
</head> | |
<body> | |
<div data-role="page"> | |
<div data-role="header" id="header"> | |
<h2>RasPi Radio Player</h2> | |
</div> | |
<div data-role="content"> | |
<p><? echo $content; ?></p> | |
</div> | |
<div role="main" class="ui-content"> | |
<ul data-role="listview" data-inset="true"> | |
<li><a href="index.php?id=stop">再生停止</a></li> | |
<li><a href="index.php?id=check">確認</a></li> | |
</ul> | |
<ul data-role="listview" data-inset="true"> | |
<li><a href="index.php?id=one">NHK 仙台第一</a></li> | |
<li><a href="index.php?id=two">NHK 第二(全国)</a></li> | |
<li><a href="index.php?id=fm">NHK FM 仙台</a></li> | |
<li><a href="index.php?id=tbc">TBC 東北放送</a></li> | |
</ul> | |
</div> | |
<div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment