-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e750522
commit 359ff50
Showing
15 changed files
with
623 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import wolframalpha | ||
import pyttsx3 | ||
import speech_recognition | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
rate = engine.setProperty("rate",170) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
|
||
def WolfRamAlpha(query): | ||
apikey = "#paste your api key" | ||
requester = wolframalpha.Client(apikey) | ||
requested = requester.query(query) | ||
|
||
try: | ||
answer = next(requested.results).text | ||
return answer | ||
except: | ||
speak("The value is not answerable") | ||
|
||
def Calc(query): | ||
Term = str(query) | ||
Term = Term.replace("jarvis","") | ||
Term = Term.replace("multiply","*") | ||
Term = Term.replace("plus","+") | ||
Term = Term.replace("minus","-") | ||
Term = Term.replace("divide","/") | ||
|
||
Final = str(Term) | ||
try: | ||
result = WolfRamAlpha(Final) | ||
print(f"{result}") | ||
speak(result) | ||
|
||
except: | ||
speak("The value is not answerable") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os | ||
import pyautogui | ||
import webbrowser | ||
import pyttsx3 | ||
from time import sleep | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
engine.setProperty("rate",200) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
|
||
dictapp = {"commandprompt":"cmd","paint":"paint","word":"winword","excel":"excel","chrome":"chrome","vscode":"code","powerpoint":"powerpnt"} | ||
|
||
def openappweb(query): | ||
speak("Launching, sir") | ||
if ".com" in query or ".co.in" in query or ".org" in query: | ||
query = query.replace("open","") | ||
query = query.replace("jarvis","") | ||
query = query.replace("launch","") | ||
query = query.replace(" ","") | ||
webbrowser.open(f"https://www.{query}") | ||
else: | ||
keys = list(dictapp.keys()) | ||
for app in keys: | ||
if app in query: | ||
os.system(f"start {dictapp[app]}") | ||
|
||
def closeappweb(query): | ||
speak("Closing,sir") | ||
if "one tab" in query or "1 tab" in query: | ||
pyautogui.hotkey("ctrl","w") | ||
speak("All tabs closed") | ||
elif "2 tab" in query: | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
speak("All tabs closed") | ||
elif "3 tab" in query: | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
speak("All tabs closed") | ||
|
||
elif "4 tab" in query: | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
speak("All tabs closed") | ||
elif "5 tab" in query: | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
sleep(0.5) | ||
pyautogui.hotkey("ctrl","w") | ||
speak("All tabs closed") | ||
|
||
else: | ||
keys = list(dictapp.keys()) | ||
for app in keys: | ||
if app in query: | ||
os.system(f"taskkill /f /im {dictapp[app]}.exe") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import requests | ||
import json | ||
import pyttsx3 | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
rate = engine.setProperty("rate",170) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
|
||
def latestnews(): | ||
api_dict = {"business" : "https://newsapi.org/v2/top-headlines?country=in&category=business&apiKey=#here paste your api key", | ||
"entertainment" : "https://newsapi.org/v2/top-headlines?country=in&category=entertainment&apiKey=#here paste your api key", | ||
"health" : "https://newsapi.org/v2/top-headlines?country=in&category=health&apiKey=#here paste your api key", | ||
"science" :"https://newsapi.org/v2/top-headlines?country=in&category=science&apiKey=#here paste your api key", | ||
"sports" :"https://newsapi.org/v2/top-headlines?country=in&category=sports&apiKey=#here paste your api key", | ||
"technology" :"https://newsapi.org/v2/top-headlines?country=in&category=technology&apiKey=#here paste your api key" | ||
} | ||
|
||
content = None | ||
url = None | ||
speak("Which field news do you want, [business] , [health] , [technology], [sports] , [entertainment] , [science]") | ||
field = input("Type field news that you want: ") | ||
for key ,value in api_dict.items(): | ||
if key.lower() in field.lower(): | ||
url = value | ||
print(url) | ||
print("url was found") | ||
break | ||
else: | ||
url = True | ||
if url is True: | ||
print("url not found") | ||
|
||
news = requests.get(url).text | ||
news = json.loads(news) | ||
speak("Here is the first news.") | ||
|
||
arts = news["articles"] | ||
for articles in arts : | ||
article = articles["title"] | ||
print(article) | ||
speak(article) | ||
news_url = articles["url"] | ||
print(f"for more info visit: {news_url}") | ||
|
||
a = input("[press 1 to cont] and [press 2 to stop]") | ||
if str(a) == "1": | ||
pass | ||
elif str(a) == "2": | ||
break | ||
|
||
speak("thats all") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from fnmatch import translate | ||
from time import sleep | ||
from googletrans import Translator | ||
import googletrans #pip install googletrans | ||
from gtts import gTTS | ||
import googletrans | ||
import pyttsx3 | ||
import speech_recognition | ||
import os | ||
from playsound import playsound | ||
import time | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
rate = engine.setProperty("rate",170) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
|
||
def takeCommand(): | ||
r = speech_recognition.Recognizer() | ||
with speech_recognition.Microphone() as source: | ||
print("Listening.....") | ||
r.pause_threshold = 1 | ||
r.energy_threshold = 300 | ||
audio = r.listen(source,0,4) | ||
|
||
try: | ||
print("Understanding..") | ||
query = r.recognize_google(audio,language='en-in') | ||
print(f"You Said: {query}\n") | ||
except Exception as e: | ||
print("Say that again") | ||
return "None" | ||
return query | ||
|
||
def translategl(query): | ||
speak("SURE SIR") | ||
print(googletrans.LANGUAGES) | ||
translator = Translator() | ||
speak("Choose the language in which you want to translate") | ||
b = input("To_Lang :- ") | ||
text_to_translate = translator.translate(query,src = "auto",dest= b,) | ||
text = text_to_translate.text | ||
try : | ||
speakgl = gTTS(text=text, lang=b, slow= False) | ||
speakgl.save("voice.mp3") | ||
playsound("voice.mp3") | ||
|
||
time.sleep(5) | ||
os.remove("voice.mp3") | ||
except: | ||
print("Unable to translate") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import pywhatkit | ||
import pyttsx3 | ||
import datetime | ||
import speech_recognition | ||
import webbrowser | ||
from bs4 import BeautifulSoup | ||
from time import sleep | ||
import os | ||
from datetime import timedelta | ||
from datetime import datetime | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
rate = engine.setProperty("rate",170) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
def takeCommand(): | ||
r = speech_recognition.Recognizer() | ||
with speech_recognition.Microphone() as source: | ||
print("Listening.....") | ||
r.pause_threshold = 1 | ||
r.energy_threshold = 300 | ||
audio = r.listen(source,0,4) | ||
|
||
try: | ||
print("Understanding..") | ||
query = r.recognize_google(audio,language='en-in') | ||
print(f"You Said: {query}\n") | ||
except Exception as e: | ||
print("Say that again") | ||
return "None" | ||
return query | ||
|
||
strTime = int(datetime.now().strftime("%H")) | ||
update = int((datetime.now()+timedelta(minutes = 2)).strftime("%M")) | ||
|
||
def sendMessage(): | ||
speak("Who do you wan to message") | ||
a = int(input('''Person 1 - 1 | ||
Person 2 - 2''')) | ||
if a == 1: | ||
speak("Whats the message") | ||
message = str(input("Enter the message- ")) | ||
pywhatkit.sendwhatmsg("+91000000000",message,time_hour=strTime,time_min=update) | ||
elif a==2: | ||
pass |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pyttsx3 | ||
import datetime | ||
import os | ||
|
||
engine = pyttsx3.init("sapi5") | ||
voices = engine.getProperty("voices") | ||
engine.setProperty("voice", voices[0].id) | ||
engine.setProperty("rate",200) | ||
|
||
def speak(audio): | ||
engine.say(audio) | ||
engine.runAndWait() | ||
|
||
extractedtime = open("Alarmtext.txt","rt") | ||
time = extractedtime.read() | ||
Time = str(time) | ||
extractedtime.close() | ||
|
||
deletetime = open("Alarmtext.txt","r+") | ||
deletetime.truncate(0) | ||
deletetime.close() | ||
|
||
def ring(time): | ||
timeset = str(time) | ||
timenow = timeset.replace("jarvis","") | ||
timenow = timenow.replace("set an alarm","") | ||
timenow = timenow.replace(" and ",":") | ||
Alarmtime = str(timenow) | ||
print(Alarmtime) | ||
while True: | ||
currenttime = datetime.datetime.now().strftime("%H:%M:%S") | ||
if currenttime == Alarmtime: | ||
speak("Alarm ringing,sir") | ||
os.startfile("music.mp3") #You can choose any music or ringtone | ||
elif currenttime + "00:00:30" == Alarmtime: | ||
exit() | ||
|
||
ring(time) |
Oops, something went wrong.