def input(message, sender): if message.strip().upper() == "AUX": speakermanager.simulateKeyPress("AUX_INPUT") sendtext(sender, config["DEFAULT"]["ai_name"] + ": " + "You sent an Input AUX command.") if message.index("preset") > -1: if not len(message) == 8: sendtext(sender, config["DEFAULT"]["ai_name"] + ": " + "Invalid Preset, acceptable range 1-6.") else: speakermanager.simulateKeyPress(message.replace(" ", "_").upper()) sendtext(sender, message.replace(" ", "_").upper())
def input(message, sender): if message.strip().upper() == "AUX": speakermanager.simulateKeyPress("AUX_INPUT") sendtext( sender, config['DEFAULT']['ai_name'] + ": " + "You sent an Input AUX command.") if message.index("preset") > -1: if not len(message) == 8: sendtext( sender, config['DEFAULT']['ai_name'] + ": " + "Invalid Preset, acceptable range 1-6.") else: speakermanager.simulateKeyPress(message.replace(" ", "_").upper()) sendtext(sender, message.replace(" ", "_").upper())
def validatestatus(): """ ~ Validates the status of the speaker ~ Checks to see if the speaker is on and if it is playing a song """ global speakerOn try: speakerOn = urllib.request.urlopen(config['speaker']['speakerAddress'] + "now_playing").read().decode("UTF-8")\ .find("STANDBY") == -1 except URLError: speakerOn = False if not speakerOn: speakermanager.simulateKeyPress("POWER") speakermanager.clear() print("Speaker status: " + str(speakerOn))
def power(message, sender): if static.speakerOn: speakermanager.simulateKeyPress("POWER") sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "Power") static.speakerOn = not static.speakerOn
def activate(message, sender): speakermanager.simulateKeyPress(message.upper()) sendtext(sender, message.upper())