Beispiel #1
0
def micHandler(command, args):
    global old_mic_vol
    global mic_vol

    if extended_command.is_authed(args['sender']) == 2: # Owner
        if len(command) > 1:
            if command[1] == 'mute':
                networking.sendChatMessage(".Warning: Mute may not actually mute mic, use .audio stop to ensure mute")
                # Mic Mute
                old_mic_vol = mic_vol
                mic_vol = 0
            elif command[1] == 'unmute':
                # Mic Unmute
                mic_vol = old_mic_vol
            elif command[1] == 'vol':
                try:
                    new_vol = int(command[2])
                except ValueError:
                    log.debug("Not a valid volume level %s" % command[2])

                mic_vol = new_vol % 101

            log.info("Setting volume to %d" % mic_vol)
            os.system("amixer -c {} sset 'Mic' '{}%'".format(audio_hw_num, mic_vol))
            networking.sendChatMessage(".mic volume is %s" % mic_vol)
Beispiel #2
0
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)
Beispiel #3
0
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")
Beispiel #4
0
def new_voice(command, args):
    global users

    if not args['anonymous']:
        user = args['name']
        if len(command) > 1:
            if command[1] in voiceList:
                users[user] = command[1]
            else:
                users[user] = random.choice(voiceList)
        if messenger:
            networking.sendChatMessage(
                ".{} your voice is now {}".format(user, users[user]))
Beispiel #5
0
def new_voice(command, args):
    global users

    if (args['anonymous'] != True):
        user = args['name']
        if len(command) > 1:
            if command[1] in voices:
                users[user] = command[1]
            else:
                users[user] = random.choice(voices)

        if messenger:
            networking.sendChatMessage(".%s your voice is now %s" %(user, users[user]))
Beispiel #6
0
def sendChatMessage(message):
    networking.sendChatMessage(message)