commit 8d64c8a3d6c734b771d0a56cd56bb2c4e33484a3
parent ec66c646738bb8722d39097ce3701c603c5aac32
Author: rob <rob@tarina.org>
Date: Thu, 24 Aug 2023 14:13:00 +0300
deploayable
Diffstat:
M | tarinactrl.py | | | 48 | +++++++++++++++++++++++++++++++++++------------- |
1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/tarinactrl.py b/tarinactrl.py
@@ -57,13 +57,13 @@ def pingtocamera(host, port, data):
print("Sent to server..")
break
except:
- ('did not connect')
+ print('did not connect')
s.close()
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.3)
+ #s.settimeout(5)
try:
while True:
s.connect((host, port))
@@ -71,7 +71,7 @@ def sendtocamera(host, port, data):
print("Sent to server..")
break
except:
- ('did not connect')
+ print('did not connect')
s.close()
##--------------Listen for Clients-----------------------
@@ -99,7 +99,6 @@ def listenforclients(host, port, q):
q.put('')
def printmenu(recording,selected,cameras,camselected,serverstatus,rectime):
-
print(term.home+term.clear)
print(time.time())
print(rectime)
@@ -139,13 +138,14 @@ def printmenu(recording,selected,cameras,camselected,serverstatus,rectime):
a=a+1
print('-~-')
-
-menu = ["Quit","Add CAMERA","New SCENE","Sync SCENE","Record","Search","Snapshot"]
-
##----------------------Main loop starts-------------------------
def main(serverstatus):
global nextstatus, selected, cameras, menu, camselected, recording, sleep, rectime, pingip,searchforcameras
+ if recording != None:
+ menu = ["Quit","New FILM","Sync FILM","New SCENE","Sync SCENE","Stop","Retake","Search","Snapshot"]
+ else:
+ menu = ["Quit","New FILM","Sync FILM","New SCENE","Sync SCENE","Record","Retake","Search","Snapshot"]
newselected=camselected
with term.cbreak():
val=term.inkey(timeout=0)
@@ -168,11 +168,13 @@ def main(serverstatus):
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+"?:")
- cameras.append(ip)
+ elif event == "KEY_ENTER" and menu[selected] == "New FILM":
+ newfilmname=input("new film name:")
+ a=0
+ for i in cameras:
+ if i not in camerasoff:
+ sendtocamera(i,port,'NEWFILM:'+newfilmname)
+ a=a+1
elif event == "KEY_UP":
if selected > 0:
selected = selected - 1
@@ -213,7 +215,7 @@ def main(serverstatus):
if i not in camerasoff:
sendtocamera(i,port,'PING')
a=a+1
- elif event == "KEY_PGUP" or event=="KEY_ENTER" and menu[selected]=='Record':
+ elif event == "KEY_PGUP" and recording == None or event=="KEY_ENTER" and menu[selected]=='Record':
a=0
for i in cameras:
if i not in camerasoff:
@@ -236,6 +238,26 @@ def main(serverstatus):
else:
sendtocamera(i,port,'PLACEHOLDER')
a=a+1
+ elif event == "KEY_PGUP" and recording or event=="KEY_ENTER" and menu[selected]=='Stop':
+ a=0
+ for i in cameras:
+ if i not in camerasoff:
+ if a == camselected:
+ if recording == camselected:
+ sendtocamera(i,port,'STOP')
+ recording=None
+ elif a == mastersound:
+ if recording == a:
+ sendtocamera(i,port,'STOP')
+ else:
+ sendtocamera(i,port,'RECSOUND')
+ #if recording != mastersound:
+ # time.sleep(sleep)
+ # sendtocamera(i,port,'RECSOUND')
+ #else:
+ #sendtocamera(i,port,'PLACEHOLDER')
+ a=a+1
+
elif event == "0":
newselected = 0
elif event == "1":