tarinactrl

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

commit 7746115d884b99d09b2efecfcf28e4435d4e34bb
parent be1dbe2d58291463141ab1f9b3aa8fdbe1a16874
Author: rob <rob@tarina.org>
Date:   Thu, 24 Aug 2023 00:01:14 +0300

timeout

Diffstat:
Mtarinactrl.py | 24++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/tarinactrl.py b/tarinactrl.py @@ -34,7 +34,7 @@ os.system('clear') selected = 1 camselected=0 newselected=0 -mastersound=0 +mastersound=None recording=None sleep=0.2 rectime=None @@ -46,7 +46,7 @@ local_ip='' def pingtocamera(host, port, data): print("Sending to "+host+" on port "+str(port)+" DATA:"+data) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(0.01) + s.settimeout(0.1) try: while True: s.connect((host, port)) @@ -63,7 +63,7 @@ def pingtocamera(host, port, data): def sendtocamera(host, port, data): print("Sending to "+host+" on port "+str(port)+" DATA:"+data) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.settimeout(0.1) + s.settimeout(0.3) try: while True: s.connect((host, port)) @@ -88,9 +88,10 @@ def listenforclients(host, port, q): if not data: break ctrltime=time.time() - tarinatime=data.decode() - lag=ctrltime-float(tarinatime) - status = addr[0], str(lag*1000), tarinatime + tarinadata=data.decode() + #lag=ctrltime-float(tarinatime) + #status = addr[0], str(lag*1000), tarinatime + status = addr[0], tarinadata c.close() q.put(status) break @@ -110,11 +111,6 @@ def printmenu(recording,selected,cameras,camselected,serverstatus,rectime): try: print(serverstatus[0]) print(serverstatus[1]) - if rectime: - if isinstance(serverstatus[2],float): - print("rectime lag: "+str((rectime-serverstatus[2])*1000)) - if isinstance(serverstatus[2],str): - print(serverstatus[2]) except: print('') if recording != None: @@ -189,7 +185,7 @@ def main(serverstatus): if i not in camerasoff: if a == camselected: if recording == camselected: - sendtocamera(i,port,'STOP') + sendtocamera(i,port,'RETAKE') recording=None else: sendtocamera(i,port,'RETAKE') @@ -223,7 +219,7 @@ def main(serverstatus): if i not in camerasoff: if a == camselected: if recording == camselected: - sendtocamera(i,port,'STOP') + sendtocamera(i,port,'REC') recording=None else: sendtocamera(i,port,'REC') @@ -318,6 +314,6 @@ if __name__ == '__main__': serverstatus = q.get() p = Process(target=listenforclients, args=('0.0.0.0', port, q)) p.start() - time.sleep(0.1) + time.sleep(0.02) p.terminate() quit()