def videoChatHandler(command, args): global video_process global video_bitrate if len(command) > 1: if extended_command.is_authed(args['sender']) == 2: # Owner if command[1] == 'start': if not video_process.returncode == None: watchdog.start("FFmpegCameraProcess", startVideoCapture) elif command[1] == 'stop': stopVideoCapture() elif command[1] == 'restart': restartVideoCapture() elif command[1] == 'bitrate': if len(command) > 1: if len(command) == 3: try: int(command[2]) video_bitrate = command[2] restartVideoCapture() except ValueError: # Catch someone passing not a number pass networking.sendChatMessage(".Video bitrate is %s" % video_bitrate) else: networking.sendChatMessge("command only available to owner")
def audioChatHandler(command, args): global audio_process global audio_bitrate global mic_off if len(command) > 1: if extended_command.is_authed(args['sender']) == 2: # Owner if command[1] == 'start': # mic_off = False if audio_process.returncode != None: watchdog.start("FFmpegAudioProcess", startAudioCapture) elif command[1] == 'stop': stopAudioCapture() elif command[1] == 'restart': # mic_off = False stopAudioCapture() watchdog.start("FFmpegAudioProcess", startAudioCapture) elif command[1] == 'bitrate': if len(command) > 1: if len(command) == 3: try: int(command[2]) audio_bitrate = command[2] restartAudioCapture() except ValueError: # Catch someone passing not a number pass networking.sendChatMessage(".Audio bitrate is %s" % audio_bitrate)
def start(): if not no_camera: watchdog.start("FFmpegCameraProcess", startVideoCapture) if not no_mic: if not mic_off: # watchdog.start("FFmpegAudioProcess", startAudioCapture) watchdog.start("FFmpegAudioProcess", startAudioCapture)
def start(): if not no_camera: watchdog.start("FFmpegCameraProcess", startVideoCapture) schedule.task(90, networking.sendOnlineState, True) atexit.register(networking.sendOnlineState, False) if not no_mic: if not mic_off: # watchdog.start("FFmpegAudioProcess", startAudioCapture) watchdog.start("FFmpegAudioProcess", startAudioCapture)
def startListenForChatServer(): global chatSocket chatSocket = SocketIO(chatHostPort['host'], chatHostPort['port'], LoggingNamespace, transports='websocket') log.info("Connected to chat socket.io") chatSocket.on('chat_message_with_name', onHandleChatMessage) chatSocket.on('connect', onHandleChatConnect) chatSocket.on('reconnect', onHandleChatReconnect) chatSocket.on('disconnect', onHandleChatDisconnect) watchdog.start("ChatServerListen", waitForChatServer) return chatSocket
def startListenForMessengerServer(): global messengerSocket cookie = getMessengerAuthToken() if not cookie.status_code == 200: log.error('ERROR : Messenger username / password rejected by server') sys.exit() messengerSocket = SocketIO('https://%s' % messengerHost, messengerPort, LoggingNamespace, cookies={'connect.sid': cookie.cookies['connect.sid']}, transports='websocket') log.info("Connected to messenger chat socket.io") messengerSocket.on('connect', onHandleMessengerConnect) messengerSocket.on('reconnect', onHandleMessengerReconnect) messengerSocket.on('disconnect', onHandleMessengerDisconnect) watchdog.start("MessengerServerListen", waitForMessengerServer) return messengerSocket
def restartAudioCapture(): stopAudioCapture() if not mic_off: watchdog.start("FFmpegAudioProcess", startAudioCapture)
def restartVideoCapture(): stopVideoCapture() watchdog.start("FFmpegCameraProcess", startVideoCapture)
def run(self): watchdog.start()
def startListenForWebSocket(): global webSocket watchdog.start("WebSocketListen", waitForWebSocket)
def startListenForChatServer(): # thread.start_new_thread(waitForChatServer, ()) watchdog.start("ChatServerListen", waitForChatServer)
def startListenForControlServer(): watchdog.start("ControlServerListen", waitForControlServer)
def startListenForAppServer(): watchdog.start("AppServerListen", waitForAppServer)