def youtube(search): speak("Opening in youtube") u_query=search.lower() u_query=u_query.replace("search in youtube","",1) u_query=u_query.replace("search youtube","",1) driver.get("http://www.youtube.com") # print("http://www.youtube.com/results?search_query =" + str(u_query)) msgbox=WebDriverWait(driver,15).until(EC.visibility_of(driver.find_element_by_xpath('//*[@id="search"]'))) msgbox.click() msgbox.send_keys(str(u_query)) keyboard.press_and_release("\n")
def date(): year = int(datetime.datetime.now().year) month = int(datetime.datetime.now().month) date = int(datetime.datetime.now().day) speak("the current Date is") speak(date) speak(month) speak(year)
from speak_listen import listen, speak if __name__ == "__main__": while True: transcript = listen().split() if transcript[0] == "안녕": speak("네, 안녕하세요.")
def time(): Time = datetime.datetime.now().strftime("%I:%M:%S") speak("the current Time is") speak(Time)
def walcome(): speak("Welcome back sir") hour = int(datetime.datetime.now().hour) if hour>=6 and hour<12: speak("Good Morning!") elif hour>=12 and hour<18: speak("Good Afternoon!") elif hour>=18 and hour<24: speak("Good Evening!") else: speak("Good Night!") speak("Jarvis at your Service. Please tell me how can I help You ")
def process_text(command): query = command # Logic for executing tasks based on query if 'music song' in query and 'next' in query: winQ.Music.next_music() return True elif 'previous' in query and 'music song' in query: winQ.Music.previous_music() return True elif 'play' in query and 'music song' in query: winQ.Music.play() return True elif 'the time' in query: winQ.wishMe.Time() return True elif 'open code' in query: codePath = "C:\\Users\\Haris\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" os.startfile(codePath) return True elif ('bye' in query and 'jarvis' in query): speak('okay') speak('Bye Sir, have a good day.') sys.exit() elif 'search' in command: print("in search ") search_web(query) elif "who are you" in query or "define yourself" in query: sp = '''Hello, I am Person. Your personal Assistant. I am here to make your life easier. You can command me to perform various tasks such as calculating sums or opening applications etcetra''' speak(sp) elif "who made you" in query or "created you" in query: sp = "I have been created by Parth and Karan." speak(sp) elif "calculate" in query.lower(): # write your wolframalpha app_id here app_id = '8QAHQL-2VG7J6RRYW' client = wolframalpha.Client(app_id) indx = query.lower().split().index('calculate') query = query.split()[indx + 1:] res = client.query(' '.join(query)) answer = next(res.results).text speak("The answer is " + answer) elif 'open' in query and 'software' in query: pass # os.open("c:\\") # open_application(query.lower()) else: speak("I can search the web for you, Do you want to continue?") ans = listen_command() if 'yes' in str(ans) or 'yeah' in str(ans): search_web(query) else: speak('okay') speak('Bye Sir, have a good day.') sys.exit() print("after sys.exit()")