From 3d380c23e42661eacba50e629a7e79d2d8a6a87b Mon Sep 17 00:00:00 2001
From: 42loop <ulf.freyhoff@hfbk-hamburg.de>
Date: Wed, 29 Apr 2020 13:41:46 +0200
Subject: [PATCH] fixed crontab issue, modified style, fixed pngview issue
 loosing tvservice on hdmi off

---
 README.md        | 14 +++++++++++++-
 assets/style.css | 23 ++++++++++++++++++++++-
 hbue.py          | 12 ++++++------
 hdmi_off.sh      |  4 ++++
 hdmi_on.sh       |  4 ++++
 5 files changed, 49 insertions(+), 8 deletions(-)
 create mode 100755 hdmi_off.sh
 create mode 100755 hdmi_on.sh

diff --git a/README.md b/README.md
index 10dc8f3..b303c8c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
+directories:
+/home/pi/uploads for all uploads
+/home/pi/thumbnails for generated thumbnails
+/home/pi/video for 'the' video
+/home/pi/image for 'the' image
+
 launch with
 
-./hbue.py --credentials 'user:password' --folder /home/pi/uploads/
\ No newline at end of file
+./hbue.py --credentials 'user:password' --folder /home/pi/uploads/
+
+expects crontab entries similar to this:
+
+00 13 * * 1,3,4,5 /home/pi/hdmi_on.sh # hdmi_on
+00 14 * * 1,3,4,5 /home/pi/hdmi_off.sh # hdmi_off
+
diff --git a/assets/style.css b/assets/style.css
index bd8b69e..db78648 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -1,3 +1,12 @@
+a:link {
+  color: black;
+}
+
+/* visited link */
+a:visited {
+  color: black;
+}
+
 .weekday {
   cursor: pointer;
   font-style: bold;
@@ -7,6 +16,9 @@
   padding:10px;
   height:20px;
   width:42px;
+  border-style: solid;
+  border-radius: 5px;
+
 }
 
 .mbutton {
@@ -25,9 +37,11 @@
 .selectmedia {
   cursor: pointer;
   min-height: 20px;
-  border: 2px solid rgba(255, 0, 0, 0.3);
   background: darkgray;
   padding: 5px 5px; 
+  border-style: solid;
+  border-radius: 5px;
+
 }
 
 
@@ -39,6 +53,8 @@
   text-indent:-99999em;
   width:80px; /* your image width */
   vertical-align: middle;
+  border-style: solid;
+  border-radius: 5px;
   
 }
 
@@ -50,6 +66,9 @@
   text-indent:-99999em;
   width:80px; /* your image width */
   vertical-align: middle;
+  border-style: solid;
+  border-radius: 5px;
+
 }
 
 .selected {
@@ -60,6 +79,8 @@
   text-indent:-99999em;
   width:80px; /* your image width */
   vertical-align: middle;
+  border-style: solid;
+  border-radius: 5px;
 }
 
 img {height:80px;display:inline-block;vertical-align: middle}
diff --git a/hbue.py b/hbue.py
index 2f11873..b645c55 100755
--- a/hbue.py
+++ b/hbue.py
@@ -238,16 +238,16 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
 				print(param)
 				if param=="on":
 					print("hdmi on")
-					os.system("/usr/bin/tvservice -p")
+					os.system("/home/pi/hdmi_on.sh")
 					#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+" &")
+					#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")
+					os.system("/home/pi/hdmi_off.sh")
 
 				self.send_response(200)
 				self.send_header('Content-type','text/plain; charset=UTF-8')
diff --git a/hdmi_off.sh b/hdmi_off.sh
new file mode 100755
index 0000000..6440520
--- /dev/null
+++ b/hdmi_off.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+/usr/bin/pkill -f pngview
+/usr/bin/tvservice -o
diff --git a/hdmi_on.sh b/hdmi_on.sh
new file mode 100755
index 0000000..07d5a49
--- /dev/null
+++ b/hdmi_on.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+/usr/bin/tvservice -p
+/home/pi/raspidmx/pngview/pngview /home/pi/image/* &
-- 
GitLab