commit 57f60f46dae290bee94e6eb92a4f4344379ccc70
parent c74d449940ef3d140ed2adcac7381b59fceee7f0
Author: rob <rob@tarina.org>
Date: Fri, 17 Mar 2023 17:19:36 +0000
improving web gui
Diffstat:
3 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py
@@ -147,11 +147,26 @@ class index:
def GET(self):
interface=open('/dev/shm/interface','r')
menu=interface.readlines()
- selected=int(menu[0])
- name=menu[3].split(':')[1]
- scene=menu[4].split(':')[1].split('/')[0]
- shot=menu[5].split(':')[1].split('/')[0]
- take=menu[6].split(':')[1].split('/')[0]
+ try:
+ selected=int(menu[0])
+ except:
+ selected=0
+ try:
+ name=menu[3].split(':')[1]
+ except:
+ name=''
+ try:
+ scene=menu[4].split(':')[1].split('/')[0]
+ except:
+ scene=1
+ try:
+ shot=menu[5].split(':')[1].split('/')[0]
+ except:
+ shot=1
+ try:
+ take=menu[6].split(':')[1].split('/')[0]
+ except:
+ take=1
films = getfilms(filmfolder)
renderedfilms = []
unrenderedfilms = []
@@ -196,11 +211,27 @@ class index:
time.sleep(0.5)
interface=open('/dev/shm/interface','r')
menu=interface.readlines()
- selected=int(menu[0])
- scene=menu[4].split(':')[1].split('/')[0]
- shot=menu[5].split(':')[1].split('/')[0]
- take=menu[6].split(':')[1].split('/')[0]
- session.reload = 0
+ try:
+ selected=int(menu[0])
+ except:
+ selected=0
+ try:
+ name=menu[3].split(':')[1]
+ except:
+ name=''
+ try:
+ scene=menu[4].split(':')[1].split('/')[0]
+ except:
+ scene=1
+ try:
+ shot=menu[5].split(':')[1].split('/')[0]
+ except:
+ shot=1
+ try:
+ take=menu[6].split(':')[1].split('/')[0]
+ 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)
diff --git a/srv/templates/index.html b/srv/templates/index.html
@@ -22,7 +22,7 @@ $for m in menu[3:]:
$ y+=1
</div>
$ 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"/><br>
+<img width="80%" src="$picture?$randhash"/><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>
diff --git a/tarina.py b/tarina.py
@@ -226,7 +226,7 @@ def main():
elif pressed == 'picture':
if os.path.isdir(foldername) == False:
os.makedirs(foldername)
- picture = foldername +'picture' + str(shot).zfill(3) + '.jpeg'
+ picture = foldername +'picture' + str(take).zfill(3) + '.jpeg'
print('taking picture')
camera.capture(picture,format="jpeg",use_video_port=True)
#INSERT SCENE