예제 #1
0
def chooseIntent(response):
    # convert all responses to uniform lower-case
    intent = getIntent(response)
    intent = intent.lower()

    print(intent)

    # parse for commands:
    if (intent == 'playaudio'):
        mpdCommands("playPlaylist", "welcome to the house") # default hype playlist
        mpdCommands("playSong", None)
    elif (intent == 'playplaylist'):
        voice("playing the playlist " + getEntities(response)['playlist'][0]['value'])
        mpdCommands("playPlaylist", getEntities(response)['playlist'][0]['value'])
        mpdCommands("playSong", None)
    elif (intent == 'stopsong'):
        mpdCommands('pauseSong', None)
    elif (intent == 'nextsong'):
        mpdCommands('nextSong', None)
    elif (intent == 'appreciation'):
        voice("no problem")
    elif (intent == 'weather'):
        loc = getEntities(response)['location']['value']
        if loc == 'errorparse':
            data = open("config.json")
            data = json.loads(data)
            weatherLocation(data["zip"])
        weatherLocation(loc)
    else: 
        main()
        return
    main()
예제 #2
0
def chooseIntent(response):
    # convert all responses to uniform lower-case
    intent = getIntent(response)
    intent = intent.lower()

    print(intent)

    # parse for commands:
    if intent == "playaudio":
        mpdCommands("playPlaylist", "welcome to the house")  # default hype playlist
        mpdCommands("playSong", None)
    elif intent == "playplaylist":
        voice("playing the playlist " + getEntities(response)["playlist"][0]["value"])
        mpdCommands("playPlaylist", getEntities(response)["playlist"][0]["value"])
        mpdCommands("playSong", None)
    elif intent == "stopsong":
        print("this should stop the song")
        mpdCommands("pauseSong", None)
        print("no?")
    elif intent == "nextsong":
        mpdCommands("nextSong", None)
    elif intent == "appreciation":
        voice("no problem")
    elif intent == "weather":
        loc = getEntities(response)["location"]["value"]
        weatherLocation(loc)
    else:
        main()
        return
    main()