tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit c74d449940ef3d140ed2adcac7381b59fceee7f0
parent 15e3c51894b8dfe9a467f62c538d57b84e1368ad
Author: rob <rob@tarina.org>
Date:   Fri, 17 Mar 2023 16:50:59 +0000

take pictures

Diffstat:
Msrv/tarinaserver.py | 18+++++++++++++++---
Msrv/templates/index.html | 9+++++++--
Mtarina.py | 14++++++++++++--
3 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py @@ -6,7 +6,8 @@ import socket import ifaddr import sys import time - +import random +import hashlib # Get path of the current dir, then use it as working directory: rundir = os.path.dirname(__file__) @@ -147,6 +148,10 @@ class index: 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] films = getfilms(filmfolder) renderedfilms = [] unrenderedfilms = [] @@ -181,16 +186,23 @@ class index: sendtocamera(ip,port,'MIDDLE') elif i.func == 'delete': sendtocamera(ip,port,'DELETE') + elif i.func == 'picture': + sendtocamera(ip,port,'PICTURE') + session.reload = 1 if i.func != None: session.reload = 1 raise web.seeother('/') if session.reload == 1: - time.sleep(0.35) + 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 - return render.index(renderedfilms, unrenderedfilms, session.cameras, menu, selected) + 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) 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) +$def with (renderedfilms, unrenderedfilms, cameras, menu, selected,name,scene,shot,take,str,randhash) $var renderedfilms = renderedfilms $var unrenderedfilms = unrenderedfilms <script> @@ -21,16 +21,21 @@ $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" +<img width="80%" src="$picture"/><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: <p>--------------------------------------------------------------</p> <h2>$i</h2> - <a href="static/Videos/$i/${i}.mp4"><img width="80%" src="static/Videos/$i/scene001/shot001/take001.jpeg"/></a><br> + <a href="static/Videos/$i/${i}.mp4"><img width="80%" src="static/Videos/$i/scene001/shot001/take001.jpeg?$randhash"/></a><br> <p>Copy project to your destination:</p> <pre>scp -r pi@tarina.local:~/Videos/$i ~/films/$i</pre> <h1>Films unrendered</h1> diff --git a/tarina.py b/tarina.py @@ -222,6 +222,14 @@ def main(): writemessage('Hold on shutting down...') time.sleep(1) run_command('sudo shutdown -h now') + #PICTURE + elif pressed == 'picture': + if os.path.isdir(foldername) == False: + os.makedirs(foldername) + picture = foldername +'picture' + str(shot).zfill(3) + '.jpeg' + print('taking picture') + camera.capture(picture,format="jpeg",use_video_port=True) + #INSERT SCENE #PEAKING elif pressed == 'peak' and recordable == True: if shot > 1: @@ -1152,9 +1160,9 @@ def sendtoserver(host, port, data): def listenforclients(host, port, q): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - s.bind((host,port)) #s.settimeout(0) try: + s.bind((host,port)) print("listening on port "+str(port)) s.listen(5) c, addr = s.accept() @@ -3311,7 +3319,9 @@ def getbutton(lastbutton, buttonpressed, buttontime, holdbutton): print('tarinactrl ip:' + tarinactrl_ip) process = Process(target=listenforclients, args=("0.0.0.0", port, que)) process.start() - if nextstatus=="UP": + if nextstatus=="PICTURE": + pressed="picture" + elif nextstatus=="UP": pressed="up" elif nextstatus=="DOWN": pressed="down"