commit 5f711b00231e34ce9ebd9b5e8bf467aa3d4aba8a
parent 8dce44bdda76ac5e2bc758f7e4121a5dd74a1973
Author: rob <rob@tarina.org>
Date: Fri, 17 Mar 2023 19:58:28 +0000
web godis
Diffstat:
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py
@@ -46,12 +46,13 @@ app = web.application(urls, globals())
render = web.template.render('templates/', base="base")
web.config.debug=False
store = web.session.DiskStore(basedir + '/sessions')
-session = web.session.Session(app,store,initializer={'login': 0, 'user': '', 'backurl': '', 'bildsida': 0, 'cameras': [], 'reload': 0})
+session = web.session.Session(app,store,initializer={'login': 0, 'user': '', 'backurl': '', 'bildsida': 0, 'cameras': [], 'reload': 0, 'randhash':''})
port=55555
ip='0.0.0.0'
cameras=[]
+session.randhash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest()
##---------------Connection----------------------------------------------
@@ -203,6 +204,7 @@ class index:
sendtocamera(ip,port,'DELETE')
elif i.func == 'picture':
sendtocamera(ip,port,'PICTURE')
+ session.randhash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest()
session.reload = 1
if i.func != None:
session.reload = 1
@@ -232,8 +234,11 @@ class index:
except:
take=1
session.reload = 0
- randhash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest()
- return render.index(renderedfilms, unrenderedfilms, session.cameras, menu, selected,name,scene,shot,take,str,randhash)
+
+ thumb="static/Videos/" + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".jpeg"
+ if os.path.exists(thumb) == False:
+ thumb=''
+ return render.index(renderedfilms, unrenderedfilms, session.cameras, menu, selected,name,scene,shot,take,str,session.randhash,thumb)
class films:
def GET(self, film):
diff --git a/srv/templates/index.html b/srv/templates/index.html
@@ -1,4 +1,4 @@
-$def with (renderedfilms, unrenderedfilms, cameras, menu, selected,name,scene,shot,take,str,randhash)
+$def with (renderedfilms, unrenderedfilms, cameras, menu, selected,name,scene,shot,take,str,randhash,thumb)
$var renderedfilms = renderedfilms
$var unrenderedfilms = unrenderedfilms
<script>
@@ -6,12 +6,15 @@ function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
</script>
-
connected
$for i in cameras:
$i
<br>
-<br>
+<a href="/?func=view">VIEW</a> <a href="/?func=up">__UP__</a> <a href="/?func=record">RECORD</a><br>
+<a href="/?func=left">LEFT</a> <a href="/?func=middle">MIDDLE</a> <a href="/?func=right">RIGHT</a><br>
+<a href="/?func=delete">DELETE</a> <a href="/?func=down">DOWN</a> <a href="/?func=retake">RETAKE</a><br>
+<a href="/?func=picture">PICTURE</a>
+<a href="/?func=search">SEARCH</a>
<div id="menu" style="margin:0 auto; width:80%">
$ y=0
$for m in menu[3:]:
@@ -21,18 +24,12 @@ $for m in menu[3:]:
$m
$ y+=1
</div>
-$ picture="static/Videos/" + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/picture" + str(take).zfill(3) + ".jpeg"
+$if thumb:
+ $ picture="static/Videos/" + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/take" + str(take).zfill(3) + ".jpeg"
+$else:
+ $ picture="static/Videos/" + name + "/scene" + str(scene).zfill(3) + "/shot" + str(shot).zfill(3) + "/picture" + str(take).zfill(3) + ".jpeg"
<img width="80%" src="$picture?$randhash"/><br>
<br>
-TARINACNTRL
-<br>
-<br>
-<a href="/?func=view">VIEW</a> <a href="/?func=up">__UP__</a> <a href="/?func=record">RECORD</a><br>
-<a href="/?func=left">LEFT</a> <a href="/?func=middle">MIDDLE</a> <a href="/?func=right">RIGHT</a><br>
-<a href="/?func=delete">DELETE</a> <a href="/?func=down">DOWN</a> <a href="/?func=retake">RETAKE</a><br>
-<br>
-<a href="/?func=picture">PICTURE</a>
-<br>
<h1>FILMS</h1>
$for i in renderedfilms:
diff --git a/tarina.py b/tarina.py
@@ -3308,7 +3308,7 @@ def flushbutton():
break
def getbutton(lastbutton, buttonpressed, buttontime, holdbutton):
- global i2cbuttons, serverstate, nextstatus, process, que
+ global i2cbuttons, serverstate, nextstatus, process, que, tarinactrl_ip
#Check controller
pressed = ''
if process.is_alive() == False and serverstate == 'on':
@@ -3316,7 +3316,7 @@ def getbutton(lastbutton, buttonpressed, buttontime, holdbutton):
if "*" in nextstatus:
tarinactrl_ip = nextstatus.split('*')[1]
nextstatus = nextstatus.split('*')[0]
- print('tarinactrl ip:' + tarinactrl_ip)
+ print('tarinactrl ip:' + tarinactrl_ip)
process = Process(target=listenforclients, args=("0.0.0.0", port, que))
process.start()
if nextstatus=="PICTURE":