def activate(self): self.ta = Audio(ipServer=self.ip_server, portAudio = self.portAudio, file = self.act.data["audioFile"], mg = mg, idAct = self.act.id) self.tv1 = Video(ipServer=self.ip_server, port = self.port1, file = self.act.data["video1File"]) self.tv2 = Video(ipServer=self.ip_server, port = self.port2, file = self.act.data["video2File"]) self.tv3 = Video(ipServer=self.ip_server, port = self.port3, file = self.act.data["video3File"]) self.tv4 = Video(ipServer=self.ip_server, port = self.port4, file = self.act.data["video4File"]) print("activated")
def activate(self, audioFile, video1File, video2File, video3File, video4File, id_act, mg): self.ta = Audio(ipServer=self.ip_server, portAudio=self.portAudio, file=audioFile, mg=mg, idAct=id_act) self.tv1 = Video(ipServer=self.ip_server, port=self.port1, file=video1File) self.tv2 = Video(ipServer=self.ip_server, port=self.port2, file=video1File) self.tv3 = Video(ipServer=self.ip_server, port=self.port3, file=video1File) self.tv4 = Video(ipServer=self.ip_server, port=self.port4, file=video1File) logging.debug("activated")
def data_gen(self): """ Instancy all the necessaries classes """ self.data = { "menu": MainMenu(), "audio": Audio(), "level": Level(), "map": LevelDisplay(), "inventory": InventoryDisplay(), "win": Win(), "go": GameOver() }
def setup(): global socketIO, tts, server, port watchdog() audio = Audio(commandArgs.tts_volume) server = "runmyrobot.com" #server = "52.52.213.92" if commandArgs.env == 'dev': print('DEV MODE ***************') print("using dev port 8122") port = 8122 elif commandArgs.env == 'prod': print('PROD MODE *************') print("using prod port 8022") port = 8022 else: print("invalid environment") sys.exit(0) print('using socket io to connect to', server) socketIO = SocketIO(server, port, LoggingNamespace) print('finished using socket io to connect to', server) if commandArgs.festival_tts: from tts.festival import Festival tts = Festival() else: from tts.espeak import Espeak tts = Espeak() socketIO.on('command_to_robot', on_handle_command) socketIO.on('exclusive_control', on_handle_exclusive_control) socketIO.on('chat_message_with_name', on_handle_chat_message) socketIO.on('reverse_ssh_8872381747239', startReverseSshProcess) socketIO.on('end_reverse_ssh_8872381747239', endReverseSshProcess)
start(pidFile, pidName, args) elif sys.argv[1] == "end": os.remove(pidFile) print("delete pidfile", flush=True) # This is only run on windows in the detached child process elif sys.argv[1] == "child": print("child", flush=True) data = json.loads(sys.argv[2]) print("data", flush=True) #id_ = mg.insert_one("test",{"test":data["id"],"test2":ObjectId(data["id"])}) print("test", flush=True) ta = Audio(ipServer=ip_server, portAudio=portAudio, file=data["audioFile"], mg=mg, idAct=data["id"]) tv1 = Video(ipServer=ip_server, port=port1, file=data["video1File"]) tv2 = Video(ipServer=ip_server, port=port2, file=data["video2File"]) tv3 = Video(ipServer=ip_server, port=port3, file=data["video3File"]) tv4 = Video(ipServer=ip_server, port=port4, file=data["video4File"]) print("video", flush=True)
class server: """Servidor""" ta = "" tv1 = "" tv2 = "" tv3 = "" tv4 = "" def __init__(self): self.ip_server = "192.168.1.128" self.portAudio = 5000 self.port1 = 5001 self.port2 = 5002 self.port3 = 5003 self.port4 = 5004 def configActividad(self): NombreActividad= datetime.now().strftime("%d-%m-%Y-%H-%M-%S") root = 'db/'+ NombreActividad os.makedirs(root, exist_ok=True) self.act = actividad(root) print("configured activity") def activate(self): self.ta = Audio(ipServer=self.ip_server, portAudio = self.portAudio, file = self.act.data["audioFile"], mg = mg, idAct = self.act.id) self.tv1 = Video(ipServer=self.ip_server, port = self.port1, file = self.act.data["video1File"]) self.tv2 = Video(ipServer=self.ip_server, port = self.port2, file = self.act.data["video2File"]) self.tv3 = Video(ipServer=self.ip_server, port = self.port3, file = self.act.data["video3File"]) self.tv4 = Video(ipServer=self.ip_server, port = self.port4, file = self.act.data["video4File"]) print("activated") def start(self): self.ta.start() self.tv1.start() self.tv2.start() self.tv3.start() self.tv4.start() print("listening") def record(self): self.ta.record() self.tv1.record() self.tv2.record() self.tv3.record() self.tv4.record() self.act.startRecording() print("recording") def finished(self): self.ta.finished() self.tv1.finished() self.tv2.finished() self.tv3.finished() self.tv4.finished() self.act.endRecording() print("finished") def processVideo(self): self.op = OPVideo(mg = mg) self.op.getKeyPointsVideo(input = self.act.data["video1File"], outputV = self.act.data["videoout1File"],idact = self.act.id,iduser=0) logging.debug("video1") self.op = OPVideo(mg = mg) self.op.getKeyPointsVideo(input = self.act.data["video2File"], outputV = self.act.data["videoout2File"],idact = self.act.id,iduser=1) logging.debug("video2") self.op = OPVideo(mg = mg) self.op.getKeyPointsVideo(input = self.act.data["video3File"], outputV = self.act.data["videoout3File"],idact = self.act.id,iduser=2) logging.debug("video3") self.op = OPVideo(mg = mg) self.op.getKeyPointsVideo(input = self.act.data["video4File"], outputV = self.act.data["videoout4File"],idact = self.act.id,iduser=3) logging.debug("video4") del self.op
from audio.audio import Audio import threading import logging from datetime import datetime import time if __name__ == '__main__': ip_server = "192.168.1.128" portAudio = 5000 output = "audio/outputTest.wav" audio = Audio(ipServer=ip_server, portAudio=portAudio, file=output, mode=False) audio.start() audio.record() time.sleep(20) audio.finished()