コード例 #1
0
def sendRecording(file_path):
	AWS_socket = tcp.TCPsocket()
	AWS_socket.connect(AWS_IP, AWS_FILE_PORT)
	try:
		AWS_socket.sendFile(file_path)
		os.remove(file_path)
	except:
		print("Error sending file: " + file_path)
		pass
コード例 #2
0
 def __init__(self, IP="0.0.0.0", volume_port=5005, dance_port=4204):
     self.IP = IP
     self.dance_port = dance_port
     self.volume_port = volume_port
     self.danceDataQueue = queue.Queue()
     self.audioFileQueue = queue.Queue()
     self.commandQueue = queue.Queue()
     self.audioConnection = tcp.TCPsocket()
     #get rid of this try block
     try:
         self.audioConnection.listen(self.IP, self.volume_port)
     except:
         print("WTFWTFWTF")
         pass
コード例 #3
0
def controlInterface():
	try:
		AWS_socket = tcp.TCPsocket()
		AWS_socket.connect(AWS_IP, AWS_COMMAND_PORT)
		print("Connected to AWS control interface on port " + str(AWS_COMMAND_PORT))
		while True:
			message = AWS_socket.receiveMessage()
			if message.lower() == "file":
				AWS_socket.sendFile(RECORD_QUEUE.get())
			elif message in COMMANDS:
				# AWS_socket.sendMessage("Received: " + message)
				COMMAND_QUEUE.put(message)
				if message.lower() == "stop":
					AWS_socket.closeSocket()
					break
			else:
				AWS_socket.sendMessage("Invalid command: " + message)
	except:
		print("Lost connection to AWS control interface")
		global LOST_CONNECTION_FLAG
		LOST_CONNECTION_FLAG = 1
コード例 #4
0
    output = a.stdout.read()
    a.stdout.close()
    a.stdin.close()
    return output


##########################################
#MAIN
##########################################

if __name__ == "__main__":
    begin_flag = 1
    audioStream = threading.Thread(
        target=runFileServer)  # should this be processs or thread ?
    audioStream.start()
    visualizer = tcp.TCPsocket()
    visualizerThread = threading.Thread(target=visualizer.listen,
                                        args=[IP, VISUALIZER_PORT])
    visualizerThread.start()

    mainInterface = CentralIO()
    danceIOThread = threading.Thread(target=mainInterface.danceServer)
    #danceIOThread.start()
    volumeControl = VolumeController()
    audioIOThread = threading.Thread(target=mainInterface.audioIO)
    audioIOThread.start()
    volume = 5  # set this as the begining
    epoch = 0
    while (True):

        epoch += 1