예제 #1
0
	def do(self):
		if self.get_type() == "joke":
			joke.get_joke_text()
		elif self.get_type() == "weather":
			weather.get_weather()
		elif self.get_type() == "play":
			if music.channel1.get_queue() == None:
				for song in os.listdir('./music'):
					print song
					music.add_song_to_queue(song)
		elif self.get_type() == "pause":
			music.pause_song()
		elif self.get_type() == "resume":
			music.resume_song()
		elif self.get_type() == "skip":
			music.next_song()
		elif self.get_type() == "stop":
			music.stop_song()
		elif self.get_type() == "name":
			name.do()
		elif self.get_type() == "created":
			creators.do()
		elif self.get_type() == "mood":
			having_date.do()
		elif self.get_type() == "security":
			return security.toggle_security()
		elif self.get_type() == "selfie":
			camera_util.selfie()	
		return False;
예제 #2
0
def next():
    music.next_song()
    return Response(status=204)
예제 #3
0
 def on_next(self):
     next_song()
예제 #4
0
def process(query):

    if 'play' in query and 'music' not in query:
        answer = get_answer_from_memory('play')
    else:
        answer = get_answer_from_memory(query)

    if answer == "get time details":
        return ("Time is " + get_time())

    elif answer == "check internet connection":
        if check_internet_connection():
            return "internet is connected"
        else:
            return "internet is not connected"

    elif answer == "tell date":
        return "Date is " + get_date()

    elif answer == "on speak":
        return turn_on_speech()

    elif answer == "off speak":
        return turn_off_speech()

    elif answer == "close browser":
        close_browser()
        return "closing browser"

    elif answer == "open facebook":
        open_facebook()
        return "opening facebook"

    elif answer == "open google":
        open_google()
        return "opening google"

    elif answer == "play music":
        return play_music()

    elif answer == 'play':
        return play_specific_song(query)

    elif answer == "pause music":
        return pause_music()

    elif answer == "stop music":
        return stop_music()

    elif answer == "next song":
        return next_song()

    elif answer == "previous song":
        return previous_song()

    elif answer == 'change wallpaper':
        return change_wallpaper()

    elif answer == 'get news':
        return get_news()

    elif answer == 'change name':
        output("Okay! what do you want to call me")
        temp = take_input()
        if temp == assistant_details.name:
            return "Can't change. I think you're happy with my old name"
        else:
            update_name(temp)
            assistant_details.name = temp
            return "Now you can call me " + temp

    else:
        output("Dont know this one should i search on internet?")
        ans = take_input()
        if "yes" in ans:
            answer = check_on_wikipedia(query)
            if answer != "":
                return answer

        else:
            output("can you please tell me what it means?")
            ans = take_input()
            if "it means" in ans:
                ans = ans.replace("it means", "")
                ans = ans.strip()

                value = get_answer_from_memory(ans)
                if value == "":
                    return "Can't help with this one "

                else:
                    insert_question_and_answer(query, value)
                    return "Thanks i will remember it for the next time"

            else:
                return "can't help with this one"