Skip to content
Snippets Groups Projects
Commit 82824cb8 authored by 42loop's avatar 42loop
Browse files

added buttons for no video/no image

parent 649c7bab
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,39 @@ function manual(f)
});
}
function noimage(sender)
{
sender.style.background="yellow";
console.log(sender.id);
var client = new HttpClient();
loc='/noimage?';
console.log(loc);
client.get(loc, function(response) {
// do something with response
});
getimages();
setTimeout(() => { sender.style.background="darkgray"; }, 500);
}
function novideo(sender)
{
sender.style.background="yellow";
console.log(sender.id);
var client = new HttpClient();
loc='/novideo?';
console.log(loc);
client.get(loc, function(response) {
// do something with response
});
getvideos();
setTimeout(() => { sender.style.background="darkgray"; }, 500);
}
function setcron()
{
console.log("set cron");
......@@ -215,6 +248,20 @@ function isloaded()
dayclick(sender);
}
}
var noimagebtn=document.getElementById("noimage");
noimagebtn.onclick = function(e) {
if (!e) e = window.event;
var sender = e.srcElement || e.target;
noimage(sender);
}
var novideobtn=document.getElementById("novideo");
novideobtn.onclick = function(e) {
if (!e) e = window.event;
var sender = e.srcElement || e.target;
novideo(sender);
}
getfree();
getcurrent();
getimages();
......
......@@ -28,6 +28,7 @@ import subprocess
import json
import psutil
from PIL import Image
import time
h_on=0
h_off=0
......@@ -161,9 +162,11 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
<hr/>
<h3>Select media to show:</h3>
<!--
-->
<table><td><h3>Images</h3>current Image: <div id="currentimage"></div><br>
<td width=10><td><h3>Videos</h3>current Video: <div id="currentvideo"></div><br><tr><td valign=top><ul id="images">"""
<table><td><h3>Images</h3><table><td>current Image: <div id="currentimage"></div><td align="right"><div id="noimage" class="mbutton">None</div></table><br>
<td width=10><td><h3>Videos</h3><table><td>current Video: <div id="currentvideo"></div><td align="right"><div onclick="novideo()" id="novideo" class="mbutton">None</div></table><br><tr><td valign=top><ul id="images">"""
self.wfile.write(bytes(page_tpl, 'UTF-8'))
......@@ -236,6 +239,12 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
if param=="on":
print("hdmi on")
os.system("/usr/bin/tvservice -p")
#pngview output is missing after hdmi off/on, restore previous
os.system("pkill -f pngview")
time.sleep(.2)
current=os.listdir("/home/pi/image/")[0]
os.system("/home/pi/raspidmx/pngview/pngview -l 10 "+"/home/pi/image/"+current+" &")
if param=="off":
print("hdmi off")
os.system("/usr/bin/tvservice -o")
......@@ -272,6 +281,17 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
self.wfile.write(bytes("\t\t<li class=\"selectmedia\"><table><td align=center width=145><img src=\""+fthumb+"\"><td><a title=\"delete\" class=\"delete\" href=\"/delete?%s\">delete</a><td><a title=\"select\" class=\"select\" href=\"/execute?%s\">select</a><td width=145><a href=\"/download?%s\">%s</a><br>%s</table></li>\n" % (urllib.parse.unquote(f),urllib.parse.unquote(f),urllib.parse.unquote(f),fname,meta) , 'UTF-8'))
return
elif page == '/novideo':
print("have novideo")
os.system("pkill -f omxplayer")
currentvideo=""
return
elif page == '/noimage':
print("have noimage")
currentimage=""
os.system("pkill -f pngview")
return
elif page == '/getcurrent':
print("have get current")
......
......@@ -18,6 +18,9 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def on_created(self, event):
self.process(event)
def on_deleted(self, event):
os.system("pkill -f pngview")
def process(self, event):
print("processing",event.src_path)
os.system("pkill -f pngview")
......
......@@ -18,6 +18,10 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def on_created(self, event):
self.process(event)
def on_deleted(self, event):
os.system("pkill -f omxplayer")
def process(self, event):
print("processing",event.src_path)
os.system("pkill -f omxplayer")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment