[Android General] Arghya Biswas:
Hello Guys today I will share codes for virtual Assistance Jarvis from which you can make your own Virtual Assistance.

Requirements:

Windows 8.1/10 (not tested on other)

python & python 2

visual studio code

Some Programming knowledge.

And a working brain :p

CODE :

#Project friday

#install all the import file name below

import pyttsx3

import speech_recognition as sr

import datetime

from datetime import date

import wikipedia

import webbrowser

import os

from googlesearch import search

#Text To Speech

#Friday by [MENTION=8442723]Arghya Biswas[/MENTION]

engine = pyttsx3.init('sapi5')

voices = engine.getProperty('voices')

# print(voices[1].id)

engine.setProperty('voice', voices[1].id)

def speak(audio):

engine.say(audio)

engine.runAndWait()

def wishMe():

hour = int(datetime.datetime.now().hour)

if hour>=0 and hour<12:

speak("Good Morning Sir!")

elif hour>=12 and hour<18:

speak("Good Afternoon Sir!")

else:

speak("Good Evening Sir!")

speak("I am Jarvis. how may I help you")

def takeCommand():

r = sr.Recognizer()

with sr.Microphone() as source:

print("Listening...")

r.pause_threshold = 1

audio = r.listen(source)

try:

print("Recongnizing...")

query = r.recognize_google(audio, language='en-in')

print(f"User said: {query}\n")

except Exception: #For Error handling

print("Say that again please...")

return "None"

return query

if __name__ == "__main__":

wishMe()

while True:

query = takeCommand().lower()

#WIKIPEDIA AND GOOGLE SEARCH

if "wikipedia" in query:

speak("searching details sir...")

query.replace("wikipedia","")

results = wikipedia.summary(query,sentences=2)

print(results)

speak("According to wikipedia")

speak(results)

if "search about" in query:

speak("showing details in your browser sir...")

results = webbrowser.open("https://google.com/search?q=%s" % query)

#FRIDAY WAKE WORD

elif 'jarvis' in query:

speak("yes sir...")

elif 'you are awesome' in query:

speak("thank you sir...")

# BROWSER LINKS

elif 'open youtube' in query:

speak("opening sir...")

webbrowser.open("https://youtube.com")

elif 'open google' in query:

speak("opening sir...")

webbrowser.open("https://www.google.com")

elif 'open github' in query:

speak("opening sir...")

webbrowser.open("https://www.github.com")

elif 'open yahoo' in query:

speak("opening sir...")

webbrowser.open("https://www.yahoo.com")

elif 'open gmail' in query:

webbrowser.open("https://mail.google.com")

elif 'open snapdeal' in query:

webbrowser.open("https://www.snapdeal.com")

speak("opening sir...")

elif 'open amazon' in query or 'shop online' in query:

webbrowser.open("https://www.amazon.com")

speak("opening sir...")

elif 'open flipkart' in query:

webbrowser.open("https://www.flipkart.com")

speak("opening sir...")

elif 'open ebay' in query:

webbrowser.open("https://www.ebay.com")

speak("opening sir...")

elif 'open facebook' in query:

speak("opening sir...")

webbrowser.open("https://www.facebook.com")

elif 'open instagram' in query or 'open insta' in query:

speak("opening sir...")

webbrowser.open("https://www.instagram.com")

elif 'open telegram' in query:

speak("opening sir...")

webbrowser.open("https://web.telegram.org")

#SOCIAL MEDIA ACCOUNTS

elif 'open my facebook messages' in query:

speak("opening sir...")

webbrowser.open("https://www.facebook.com/messages/t/")

elif 'open my instagram' in query or 'open my insta' in query:

speak("opening sir...")

webbrowser.open("https://www.instagram.com/mr_jarvis_official/")

elif 'open my whatsapp' in query or 'open my whatsapp messages' in query:

speak("opening sir...")

webbrowser.open("https://web.whatsapp.com/")

elif 'open my telegram' in query or 'open my telegram messages' in query:

speak("opening sir...")

webbrowser.open("https://web.telegram.org/#/im")

#MUSIC & VIDEOS DIRECTORY

elif 'play music' in query or 'hit some music' in query:

speak ("here you go sir...")

music_dir = 'A:\\jarvis music'

songs = os.listdir(music_dir)

print(songs)

os.startfile(os.path.join(music_dir, songs[0]))

elif 'play some videos' in query or "video" in query:

speak("ok sir")

video_dir = 'A:\\New Folder\\Videoder'

videos = os.listdir(video_dir)

os.startfile(os.path.join(video_dir,videos[0]))

#DATE AND TIME

elif 'the time' in query or 'tell me the time' in query:

strTime = datetime.datetime.now().strftime("%H:%M:%S")

speak(f"Sir, the time is {strTime}")

elif 'what is the date' in query or 'tell me the date' in query:

today = date.today()

print("Today's date is", today)

speak(f"Sir, the date is {date.today()}")

#APPILICATIONS LINKS

elif 'open chrome' in query or 'open google chrome' in query:

chromePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"

os.startfile(chromePath)

speak ("opening Sir...")