tarinactrl

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

commit a77c7ce6f984100f1679317a10423e868ce11d8e
parent 8fc0f83feede9853af1e43c19248c77a4e0d0a61
Author: rob <rob@tarina.org>
Date:   Tue, 13 Dec 2022 17:10:07 +0200

deselect cameras

Diffstat:
Mtarinactrl.py | 101++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 67 insertions(+), 34 deletions(-)

diff --git a/tarinactrl.py b/tarinactrl.py @@ -14,6 +14,7 @@ from multiprocessing import Process, Queue term = Terminal() cameras = config.cameras +camerasoff =[] port = config.port nextstatus = '' serverstatus = '' @@ -72,13 +73,20 @@ def printmenu(recording,selected,cameras,camselected): a=a+1 a=0 for i in cameras: - if a != camselected: - print("["+str(a)+"] camera"+str(a+1)+" "+i) + if i in camerasoff: + if a != camselected: + print(term.grey("["+str(a)+"] camera"+str(a+1)+" "+i)) + else: + print(term.grey("["+str(a)+"] camera"+str(a+1)+" "+i+" <-----")) else: - print("["+str(a)+"] camera"+str(a+1)+" "+i+" <-----") + if a != camselected: + print("["+str(a)+"] camera"+str(a+1)+" "+i) + else: + print("["+str(a)+"] camera"+str(a+1)+" "+i+" <-----") a=a+1 -menu = ["Quit","Add CAMERA","New SCENE","Sync SCENE"] + +menu = ["Quit","Add CAMERA","New SCENE","Sync SCENE","Ping"] ##----------------------Main loop starts------------------------- @@ -114,34 +122,51 @@ def main(serverstatus): elif event == "R": a=0 for i in cameras: - if a == camselected: - if recording == camselected: - sendtocamera(i,port,'STOP') - recording=None + if i not in camerasoff: + if a == camselected: + if recording == camselected: + sendtocamera(i,port,'STOP') + recording=None + else: + sendtocamera(i,port,'RETAKE') + recording=camselected else: - sendtocamera(i,port,'RETAKE') - recording=camselected - else: - if recording != None: - sendtocamera(i,port,'PLACEHOLDER') + if recording != None: + sendtocamera(i,port,'PLACEHOLDER') + a=a+1 + elif event == "KEY_ENTER" and menu[selected] == 'Sync SCENE': + a=0 + for i in cameras: + if i not in camerasoff: + if a != 0: + if recording == None: + sendtocamera(cameras[0],port,'SYNCIP:'+i) a=a+1 elif event == "KEY_ENTER" and menu[selected]=='New SCENE': a=0 for i in cameras: - sendtocamera(i,port,'NEWSCENE') + if i not in camerasoff: + sendtocamera(i,port,'NEWSCENE') + a=a+1 + elif event == "KEY_ENTER" and menu[selected]=='Ping': + a=0 + for i in cameras: + if i not in camerasoff: + sendtocamera(i,port,'PING') a=a+1 elif event == "KEY_PGUP": a=0 for i in cameras: - if a == camselected: - if recording == camselected: - sendtocamera(i,port,'STOP') - recording=None + if i not in camerasoff: + if a == camselected: + if recording == camselected: + sendtocamera(i,port,'STOP') + recording=None + else: + sendtocamera(i,port,'REC') + recording=camselected else: - sendtocamera(i,port,'REC') - recording=camselected - else: - sendtocamera(i,port,'PLACEHOLDER') + sendtocamera(i,port,'PLACEHOLDER') a=a+1 elif event == "0": newselected = 0 @@ -153,19 +178,27 @@ def main(serverstatus): newselected = 3 elif event == "4": newselected = 4 + elif event == "-": + if cameras[camselected] not in camerasoff: + camerasoff.append(cameras[camselected]) + elif event == "+": + if cameras[camselected] not in cameras: + camerasoff.remove(cameras[camselected]) if camselected != newselected: - #change camera - a=0 - for c in cameras: - if a == camselected: - sendtocamera(c,port,'STOP') - sendtocamera(c,port,'PLACEHOLDER') - elif a == newselected: - sendtocamera(c,port,'REC') - recording=newselected - else: - sendtocamera(c,port,'PLACEHOLDER') - a=a+1 + if recording != None: + #change camera + a=0 + for c in cameras: + if c not in camerasoff: + if a == camselected: + sendtocamera(c,port,'STOP') + sendtocamera(c,port,'PLACEHOLDER') + elif a == newselected: + sendtocamera(c,port,'REC') + recording=newselected + else: + sendtocamera(c,port,'PLACEHOLDER') + a=a+1 camselected=newselected printmenu(recording,selected,cameras,camselected) return serverstatus