tarinaretake

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

commit 37c60b7d38d191d763bb44d64a6550f1f489b129
parent a26c808ba6124a0ef4f82971c56da79dd0283063
Author: rbckman <rob@tarina.org>
Date:   Wed, 15 Nov 2023 01:01:08 +0000

keyboard shortcuts to web interface

Diffstat:
Msrv/tarinaserver.py | 8+++++---
Msrv/templates/base.html | 4+++-
Msrv/templates/index.html | 42++++++++++++++++++++++++++++++++++++------
3 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/srv/tarinaserver.py b/srv/tarinaserver.py @@ -155,7 +155,7 @@ class index: renderedfilms.append(f[0]) else: unrenderedfilms.append(f[0]) - i=web.input(func=None,selected=None) + i=web.input(func=None,selected=None,retake=None) if i.selected != None: sendtocamera(ip,port,'SELECTED:'+i.selected) if i.func == 'search': @@ -168,7 +168,7 @@ class index: elif i.func == 'record': sendtocamera(ip,port,'REC') elif i.func == 'retake': - sendtocamera(ip,port,'RETAKE') + print(i.func+'fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu') elif i.func == 'up': sendtocamera(ip,port,'UP') elif i.func == 'down': @@ -187,7 +187,7 @@ class index: sendtocamera(ip,port,'PICTURE') session.randhash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() session.reload = 1 - if i.func != None: + if i.func != None or i.retake != None: session.reload = 1 raise web.seeother('/') time.sleep(1) @@ -217,6 +217,8 @@ class index: except: take=1 session.reload = 0 + if i.func == 'retake': + sendtocamera(ip,port,'RETAKE:'+shot) thumb="/static/Videos/"+name+"/scene"+str(scene).zfill(3)+"/shot"+str(shot).zfill(3)+"/picture"+str(take).zfill(3)+".jpeg" print(thumb) if os.path.isfile(basedir+thumb) == False: diff --git a/srv/templates/base.html b/srv/templates/base.html @@ -3,8 +3,10 @@ $def with (content) <HEAD> <meta charset="utf-8"> <title>Tarina | video & audio recorder with glue</title> - <link rel="stylesheet" href="/static/style.css?v=33" type="text/css" rel="stylesheet"/> + <link rel="stylesheet" href="/static/style.css?v=34" type="text/css" rel="stylesheet"/> + <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> </HEAD> + <BODY> $:content diff --git a/srv/templates/index.html b/srv/templates/index.html @@ -2,17 +2,35 @@ $def with (renderedfilms, unrenderedfilms, cameras, menu, selected,name,scene,sh $var renderedfilms = renderedfilms $var unrenderedfilms = unrenderedfilms <script> -function timedRefresh(timeoutPeriod) { - setTimeout("location.reload(true);",timeoutPeriod); -} +$$(document).on('keydown', function (event) { + if (event.which == 37) { + $$('#LEFT').trigger('click'); + } else if (event.which == 39) { + $$('#RIGHT').trigger('click'); + } else if (event.which == 38) { + $$('#UP').trigger('click'); + } else if (event.which == 40) { + $$('#DOWN').trigger('click'); + } else if (event.which == 33) { + $$('#RECORD').trigger('click'); + } else if (event.which == 34) { + $$('#RETAKE').trigger('click'); + } else if (event.which == 9) { + $$('#VIEW').trigger('click'); + } else if (event.which == 46) { + $$('#DELETE').trigger('click'); + } else if (event.which == 13) { + $$('#MIDDLE').trigger('click'); + } +}); </script> connected $for i in cameras: $i <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 id="VIEW" href="/?func=view">VIEW</a> <a id="UP" href="/?func=up">__UP__</a> <a id="RECORD" href="/?func=record">RECORD</a><br> +<a id="LEFT" href="/?func=left">LEFT</a> <a id="MIDDLE" href="/?func=middle">MIDDLE</a> <a id="RIGHT" href="/?func=right">RIGHT</a><br> +<a id="DELETE" href="/?func=delete">DELETE</a> <a id="DOWN" href="/?func=down">DOWN</a> <a id="RETAKE" 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:99%"> @@ -59,3 +77,15 @@ $if func=='show_all_films': <p>Copy project to your destination:</p> <pre>scp -r pi@tarina.local:~/Videos/$i ~/films/$i</pre> +<script> +$$('#LEFT').on('click', function () { window.open('?func=left',"_self");return false; }); +$$('#RIGHT').on('click', function () { window.open('?func=right',"_self");return false; }); +$$('#DOWN').on('click', function () { window.open('?func=down',"_self");return false; }); +$$('#UP').on('click', function () { window.open('?func=up',"_self");return false; }); +$$('#RECORD').on('click', function () { window.open('?func=record',"_self");return false; }); +$$('#RETAKE').on('click', function () { window.open('?func=retake',"_self");return false; }); +$$('#DELETE').on('click', function () { window.open('?func=delete',"_self");return false; }); +$$('#VIEW').on('click', function () { window.open('?func=view',"_self");return false; }); +$$('#MIDDLE').on('click', function () { window.open('?func=middle',"_self");return false; }); +</script> +