Ejemplo n.º 1
0
    def get_mssg(self):
        result = pickle.loads(self.s.recv(4096 * 2))
        mssg_ = result.get_mssg().strip()
        print("{} reached before if".format(mssg_))
        david_fi = result.get_david()
        brows_fi = result.get_browser()
        play_fi = result.get_play_file()
        game_fi = result.get_game()
        print(
            "david_fi = {}\nbrows_fi = {}\nplay_fi = {}\ngame_fi = {}".format(
                david_fi, brows_fi, play_fi, game_fi))

        try:
            if game_fi == 1:
                print("Playing Game")
                provide_path = give_path()
                path = provide_path.p_path()
                call_obj = callpy(path)
                call_obj.call_python_file()
        except Exception as e:
            pass

        try:
            if david_fi == 1:  #C:\Python\Python38\python.exe C:/Users/tussh/PycharmProjects/jarvis/main.py
                david = david_helper()
                david.call_david()
                """not able to call david from this commented code
                path_for_david = "C://Users//tussh//PycharmProjects//jarvis//main.py"
                david_py = callpy()
                david_py.call_python_file(path_for_david)
                """

                # open_david = mssg_
                # if open_david == "open":
                # else:
                #     open_david == "close"
                #     pass
        except Exception as e:
            pass

        try:
            if brows_fi == 1:
                print("opening Browser")
                file_to_be_searched = mssg_.replace(" ", "+")
                link_to_be_searched = "http://google.com/search?q=" + file_to_be_searched
                webbrowser.open(link_to_be_searched)
        except Exception as e:
            pass

        try:
            if play_fi == 1:
                # print("reached")
                file_to_be_searched = result.get_mssg().strip()
                sear_obj = search_f(file_to_be_searched)
                # print(file_to_be_searched)
                # print("playing file")
        except Exception as e:
            print(e)
Ejemplo n.º 2
0
def run_game():
    call_object = callpy()
    call_object.call_python_file()
Ejemplo n.º 3
0
            speak("The spelling of")
            if "what is the spelling" in query:
                base_s = "what is the spelling of"
                correct_world = find_spelling(query, base_s)
                speak("{} is".format(correct_world))
                for i in correct_world:
                    speak(i)
            else:
                base_s = "what's is the spelling of"
                correct_world = find_spelling(query, base_s)
                speak("{} is".format(correct_world))
                for i in correct_world:
                    speak(i)

        elif is_ip_world(query):
            shell_object = callpy()
            local_ip = shell_object.return_ip()
            print(local_ip)
            speak("your ip address is {}".format(local_ip))

        elif is_game(query):
            speak("running a game")
            run_game()
            run = True

        elif is_acknowledge(query):
            speak("i am fine sir, how can i help you")

        elif is_stopping(query):
            speak("shutting down")
            run = False
Ejemplo n.º 4
0
def send_welcome(message):
    bot.reply_to(message, "Game started sir")
    provide_path = give_path()
    path = provide_path.p_path()
    call_obj = callpy(path)
    call_obj.call_python_file()
Ejemplo n.º 5
0
 def call_david(self):
     paths = "C:\\Users\\tussh\\PycharmProjects\\jarvis\\main.py"
     # for david
     davi = callpy(path=paths)
     davi.call_python_file()