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
Branches
No related tags found
No related merge requests found
...@@ -109,6 +109,39 @@ function manual(f) ...@@ -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() function setcron()
{ {
console.log("set cron"); console.log("set cron");
...@@ -215,6 +248,20 @@ function isloaded() ...@@ -215,6 +248,20 @@ function isloaded()
dayclick(sender); 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(); getfree();
getcurrent(); getcurrent();
getimages(); getimages();
......
...@@ -28,6 +28,7 @@ import subprocess ...@@ -28,6 +28,7 @@ import subprocess
import json import json
import psutil import psutil
from PIL import Image from PIL import Image
import time
h_on=0 h_on=0
h_off=0 h_off=0
...@@ -161,9 +162,11 @@ class MyHandler(http.server.BaseHTTPRequestHandler): ...@@ -161,9 +162,11 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
<hr/> <hr/>
<h3>Select media to show:</h3> <h3>Select media to show:</h3>
<!--
-->
<table><td><h3>Images</h3>current Image: <div id="currentimage"></div><br> <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>current Video: <div id="currentvideo"></div><br><tr><td valign=top><ul id="images">""" <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')) self.wfile.write(bytes(page_tpl, 'UTF-8'))
...@@ -236,6 +239,12 @@ class MyHandler(http.server.BaseHTTPRequestHandler): ...@@ -236,6 +239,12 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
if param=="on": if param=="on":
print("hdmi on") print("hdmi on")
os.system("/usr/bin/tvservice -p") 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": if param=="off":
print("hdmi off") print("hdmi off")
os.system("/usr/bin/tvservice -o") os.system("/usr/bin/tvservice -o")
...@@ -272,6 +281,17 @@ class MyHandler(http.server.BaseHTTPRequestHandler): ...@@ -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')) 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 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': elif page == '/getcurrent':
print("have get current") print("have get current")
......
...@@ -18,6 +18,9 @@ class ImagesEventHandler(RegexMatchingEventHandler): ...@@ -18,6 +18,9 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def on_created(self, event): def on_created(self, event):
self.process(event) self.process(event)
def on_deleted(self, event):
os.system("pkill -f pngview")
def process(self, event): def process(self, event):
print("processing",event.src_path) print("processing",event.src_path)
os.system("pkill -f pngview") os.system("pkill -f pngview")
......
...@@ -18,6 +18,10 @@ class ImagesEventHandler(RegexMatchingEventHandler): ...@@ -18,6 +18,10 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def on_created(self, event): def on_created(self, event):
self.process(event) self.process(event)
def on_deleted(self, event):
os.system("pkill -f omxplayer")
def process(self, event): def process(self, event):
print("processing",event.src_path) print("processing",event.src_path)
os.system("pkill -f omxplayer") 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