tarinactrl

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

commit 8fc0f83feede9853af1e43c19248c77a4e0d0a61
parent a957febfe927e79943f8040b04f3832f86ffcec1
Author: rob <rob@tarina.org>
Date:   Sat, 10 Dec 2022 23:37:14 +0200

good

Diffstat:
Aconfig.py | 9+++++++++
Mtarinactrl.py | 73++++++++++++++++++++++++++++++++++++++++++++++---------------------------
2 files changed, 55 insertions(+), 27 deletions(-)

diff --git a/config.py b/config.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#<<<<mooltiplayer config>>>> + +##------setup your clients and the path to clients, simple----- + +port = 55555 +cameras = ["192.168.75.212","192.168.75.33","192.168.75.183"] diff --git a/tarinactrl.py b/tarinactrl.py @@ -13,22 +13,16 @@ from multiprocessing import Process, Queue term = Terminal() -server = config.server +cameras = config.cameras port = config.port -clientpath = config.clientpath -clientup = "" -event = "" nextstatus = '' serverstatus = '' os.system('clear') selected = 1 -camselected = 0 -newselected=None +camselected=0 +newselected=0 recording=None -port = 55555 -cameras = ["192.168.75.212"] -menu = ["","ADD CAMERA","SYNC",""] ##---------------Connection---------------------------------------------- @@ -64,12 +58,8 @@ def listenforclients(host, port, q): break except: q.put('') - -##----------------------Main loop starts------------------------- -def main(serverstatus): - global nextstatus, selected, cameras, menu, camselected, recording - newselected=camselected +def printmenu(recording,selected,cameras,camselected): print(term.home+term.on_red+term.clear) if recording != None: print("Camera "+ str(recording)+" is recording! Shut up. And Action!") @@ -87,6 +77,14 @@ def main(serverstatus): else: print("["+str(a)+"] camera"+str(a+1)+" "+i+" <-----") a=a+1 + +menu = ["Quit","Add CAMERA","New SCENE","Sync SCENE"] + +##----------------------Main loop starts------------------------- + +def main(serverstatus): + global nextstatus, selected, cameras, menu, camselected, recording + newselected=camselected with term.cbreak(): val=term.inkey(timeout=0) if val.is_sequence: @@ -99,7 +97,10 @@ def main(serverstatus): if event == "KEY_ESCAPE": nextstatus = '' serverstatus = 'exit' - if event == "KEY_ENTER" and menu[selected] == "ADD CAMERA": + elif event == "KEY_ENTER" and menu[selected] == "Quit": + print('take care, bye, bye, then') + serverstatus = 'exit' + elif event == "KEY_ENTER" and menu[selected] == "ADD CAMERA": cam=str(len(cameras)+1) if event == 'KEY_ENTER': ip=input("ip address of tarina camera"+cam+"?:") @@ -108,27 +109,40 @@ def main(serverstatus): if selected > 0: selected = selected - 1 elif event == "KEY_DOWN": - if selected < 2: + if selected < 3: selected = selected + 1 elif event == "R": a=0 for i in cameras: if a == camselected: - sendtocamera(cameras[camselected],port,'RETAKE') - recording=camselected - #else: - # sendtocamera(cameras[camselected],port,'PLACEHOLDER') + if recording == camselected: + sendtocamera(i,port,'STOP') + recording=None + else: + sendtocamera(i,port,'RETAKE') + recording=camselected + else: + if recording != None: + sendtocamera(i,port,'PLACEHOLDER') + a=a+1 + elif event == "KEY_ENTER" and menu[selected]=='New SCENE': + a=0 + for i in cameras: + sendtocamera(i,port,'NEWSCENE') + a=a+1 elif event == "KEY_PGUP": a=0 for i in cameras: if a == camselected: - sendtocamera(cameras[camselected],port,'REC') if recording == camselected: + sendtocamera(i,port,'STOP') recording=None else: + sendtocamera(i,port,'REC') recording=camselected else: - sendtocamera(cameras[camselected],port,'PLACEHOLDER') + sendtocamera(i,port,'PLACEHOLDER') + a=a+1 elif event == "0": newselected = 0 elif event == "1": @@ -144,12 +158,17 @@ def main(serverstatus): a=0 for c in cameras: if a == camselected: - sendtocamera(cameras[camselected],port,'STOP') - if a == newselected: - sendtocamera(cameras[newselected],port,'REC') + 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 - else: - return serverstatus + printmenu(recording,selected,cameras,camselected) + return serverstatus if __name__ == '__main__': serverstatus=''