mirror of
https://github.com/pkali/piradio-mini.git
synced 2026-05-20 22:34:22 +02:00
New config option - select remote controller.
This commit is contained in:
@@ -35,6 +35,31 @@ if (isset($msg)) {
|
||||
echo "</script>\r\n";
|
||||
} elseif ($msg == "audio") {
|
||||
echo "Not implemented...";
|
||||
} elseif ($msg == "remote") {
|
||||
$selected = $_POST['remote'];
|
||||
if (isset($selected)) {
|
||||
$remote = file_get_contents( "/usr/share/radio/hardware/remotes/".$selected );
|
||||
preg_match('/\n# *brand: *.*/', $remote, $matches);
|
||||
$remotename = preg_replace("/\n# *brand: */", "", $matches[0]);
|
||||
echo "Selected <b>".$remotename."</b> remote controller.<br>\r\n";
|
||||
$end = shell_exec('sudo ./scripts/set_remote.sh '.$selected );
|
||||
echo "Reboot in progress.<br>\r\n";
|
||||
echo "Wait!<br>\r\n";
|
||||
echo "<script>\r\n";
|
||||
echo "// redirect to main after 30 seconds\r\n";
|
||||
echo "window.setTimeout(function() {\r\n";
|
||||
echo " window.location.href = 'index.html';\r\n";
|
||||
echo "}, 30000);\r\n";
|
||||
echo "</script>\r\n";
|
||||
} else {
|
||||
echo "Remote controller not selected.<br>\r\n";
|
||||
echo "<script>\r\n";
|
||||
echo "// redirect to main after 2 seconds\r\n";
|
||||
echo "window.setTimeout(function() {\r\n";
|
||||
echo " window.location.href = 'index.html';\r\n";
|
||||
echo "}, 2000);\r\n";
|
||||
echo "</script>\r\n";
|
||||
}
|
||||
} elseif ($msg == "stations") {
|
||||
echo "Not implemented...";
|
||||
} elseif ($msg == "network") {
|
||||
|
||||
@@ -18,6 +18,33 @@ Audio device config<br>
|
||||
</pre>
|
||||
</form>
|
||||
<hr>
|
||||
Remote config<br>
|
||||
<form action="changeconf.php?file=remote" method="post">
|
||||
<pre>
|
||||
<?php
|
||||
$remote = file_get_contents( "/etc/lirc/lircd.conf" );
|
||||
preg_match('/\n# *brand: *.*/', $remote, $matches);
|
||||
$currentremotename = preg_replace("/\n# *brand: */", "", $matches[0]);
|
||||
$dir = '/usr/share/radio/hardware/remotes/';
|
||||
$remoteconfigs = scandir($dir);
|
||||
for ($i = 0; $i < count($remoteconfigs); $i++) {
|
||||
if (preg_match('/.conf/',$remoteconfigs[$i])) {
|
||||
$remote = file_get_contents( "/usr/share/radio/hardware/remotes/".$remoteconfigs[$i] );
|
||||
preg_match('/\n# *brand: *.*/', $remote, $matches);
|
||||
$remotename = preg_replace("/\n# *brand: */", "", $matches[0]);
|
||||
echo ' <input type="radio" name="remote" value="';
|
||||
echo $remoteconfigs[$i].'"';
|
||||
if ($remotename==$currentremotename) {
|
||||
echo ' checked';
|
||||
}
|
||||
echo "> ".$remotename."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<br><button type="submit" name="submit">Save remote config and reboot</button>
|
||||
</pre>
|
||||
</form>
|
||||
<hr>
|
||||
Update to last build from github
|
||||
<a href="update.php"><button>PiRadio update</button></a>
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user