Пример #1
0
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())
Пример #2
0
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())
Пример #3
0
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))
Пример #4
0
def power(message, sender):
    if static.speakerOn:
        speakermanager.simulateKeyPress("POWER")
    sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "Power")
    static.speakerOn = not static.speakerOn
Пример #5
0
def power(message, sender):
    if static.speakerOn:
        speakermanager.simulateKeyPress("POWER")
    sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "Power")
    static.speakerOn = not static.speakerOn
Пример #6
0
def activate(message, sender):
    speakermanager.simulateKeyPress(message.upper())
    sendtext(sender, message.upper())
Пример #7
0
def activate(message, sender):
    speakermanager.simulateKeyPress(message.upper())
    sendtext(sender, message.upper())