Skip to content

Instantly share code, notes, and snippets.

@theapi
Created September 23, 2014 18:13
Show Gist options
  • Save theapi/25b6b5a9029d8d49809a to your computer and use it in GitHub Desktop.
Save theapi/25b6b5a9029d8d49809a to your computer and use it in GitHub Desktop.
Reset button for MythTv
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reset XBMC</title>
<link rel="shortcut icon" href="/reset_xbmc.ico">
<style>
input#reset{
width:200px; /*same as the height*/
height:200px; /*same as the width*/
background-color:#ff0000;
border:1px solid #ff0000; /*same colour as the background*/
color:#fff;
font-size:1.6em;
/*set the border-radius at half the size of the width and height*/
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
/*give the button a small drop shadow*/
-webkit-box-shadow: 0 0 10px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 10px rgba(0,0,0, .75);
box-shadow: 2px 2px 15px rgba(0,0,0, .75);
position: fixed;
top: 40%;
left: 50%;
margin-top: -100px;
margin-left: -100px;
}
input#reset:active{
background:#c20b0b;
border:1px solid #c20b0b;
/*reduce the size of the shadow to give a pushed effect*/
-webkit-box-shadow: 0px 0px 5px rgba(0,0,0, .75);
-moz-box-shadow: 0px 0px 5px rgba(0,0,0, .75);
box-shadow: 0px 0px 5px rgba(0,0,0, .75);
}
</style>
</head>
<body>
<?php
if (!empty($_REQUEST['xbmc'])) {
touch('/opt/watched/xbmc_reset');
}
?>
<form>
<input type="hidden" name="xbmc" value="1" />
<input id="reset" type="submit" value="RESET XBMC" />
</form>
</body>
</html>
#!/bin/sh
# sudo apt-get install inotify-tools
WATCHED_DIR="/opt/watched"
#echo "Watching directory: $WATCHED_DIR for new files"
inotifywait -m -e ATTRIB "$WATCHED_DIR" |
while read dir eventlist eventfile
do
#echo $dir
#echo $eventlist
#echo $eventfile
if [ "$eventfile" = "xbmc_reset" ]
then
#echo $eventfile
killall -9 xbmc.bin
export DISPLAY=:0.0
nohup xbmc > /dev/null 2>&1 &
fi
done
# killall -9 xbmc.bin
# export DISPLAY=:0.0
# nohup xbmc &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment