Jarvis : The Trilogy 2.0 [Part 1]


 Jarvis 2.0 [Part 1]

Video Link :-



Source Code : -

1. Password Protection


#Paste this just below your import files
for i in range(3):
    a = input("Enter Password to open Jarvis :- ")
    pw_file = open("password.txt","r")
    pw = pw_file.read()
    pw_file.close()
    if (a==pw):
        print("WELCOME SIR ! PLZ SPEAK [WAKE UP] TO LOAD ME UP")
        break
    elif (i==2 and a!=pw):
        exit()

    elif (a!=pw):
        print("Try Again")

Paste this inside the while loop :-

elif "change password" in query:
    speak("What's the new password")
    new_pw = input("Enter the new password\n")
    new_password = open("password.txt","w")
    new_password.write(new_pw)
    new_password.close()
    speak("Done sir")
    speak(f"Your new password is{new_pw}")

    

2. Schedule My Day Function :-

elif "schedule my day" in query:
    tasks = [] #Empty list
    speak("Do you want to clear old tasks (Plz speak YES or NO)")
    query = takeCommand().lower()
    if "yes" in query:
        file = open("tasks.txt","w")
        file.write(f"")
        file.close()
        no_tasks = int(input("Enter the no. of tasks :- "))
        i = 0
        for i in range(no_tasks):
            tasks.append(input("Enter the task :- "))
            file = open("tasks.txt","a")
            file.write(f"{i}. {tasks[i]}\n")
            file.close()
    elif "no" in query:
        i = 0
        no_tasks = int(input("Enter the no. of tasks :- "))
        for i in range(no_tasks):
            tasks.append(input("Enter the task :- "))
            file = open("tasks.txt","a")
            file.write(f"{i}. {tasks[i]}\n")
            file.close()

Show My Schedule using Desktop Notification Function :-

elif "show my schedule" in query:
    file = open("tasks.txt","r")
    content = file.read()
    file.close()
    mixer.init()
    mixer.music.load("notification.mp3")
    mixer.music.play()
    notification.notify(
        title = "My schedule :-",
        message = content,
        timeout = 15
        )


3. Open Any App Function :-

elif "open" in query:   #EASY METHOD
                    query = query.replace("open","")
                    query = query.replace("jarvis","")
                    pyautogui.press("super")
                    pyautogui.typewrite(query)
                    pyautogui.sleep(2)
                    pyautogui.press("enter")  

4. Internet Speed Function :-

elif "internet speed" in query:
                    wifi  = speedtest.Speedtest()
                    upload_net = wifi.upload()/1048576         #Megabyte = 1024*1024 Bytes
                    download_net = wifi.download()/1048576
                    print("Wifi Upload Speed is", upload_net)
                    print("Wifi download speed is ",download_net)
                    speak(f"Wifi download speed is {download_net}")
                    speak(f"Wifi Upload speed is {upload_net}")


HOPE YOU LIKED IT !!

No comments:

Post a Comment