Skip to content

Instantly share code, notes, and snippets.

@anmolj7
Created January 29, 2019 21:01
Show Gist options
  • Save anmolj7/3692a2fe745a5ac17060d7c2f174b18c to your computer and use it in GitHub Desktop.
Save anmolj7/3692a2fe745a5ac17060d7c2f174b18c to your computer and use it in GitHub Desktop.
The oldest version of Jarvis I could Find....
import subprocess as sp
import omdb
import wikipedia
import wolframalpha
import serial
import time
ser = serial.Serial('COM3', baudrate = 9600, timeout=1)
time.sleep(3)
def getValues():
ser.write(b'g')
arduinoData = ser.readline().decode('ascii')
def getValue():
ser.write(b'h')
arduinoData = ser.readline().decode('ascii')
return arduinoData
print("Hello Boss ... From Now Onwards I Am Your Personal Asistant Here Is The List Of Things I Can Do: ")
print("#wiki for searching a wikipedia aritcle")
print("#wolf for solving a maths ques and for asking anyquestion")
print("#help for getting list of things i can do")
print("#cls for clearing the chat")
print("#movie for Searching Details About Movie")
lights_on = ['lights', 'on']
lights_one = ['light','on']
lights_two = ['light','off']
lights_off = ['lights', 'off']
contains_all=False
while True:
userInput = input(">")
if all(word in userInput for word in lights_on) or all(word in userInput for word in lights_one):
#contains_all=True
getValues()
print("Okay Boss")
elif all(word in userInput for word in lights_off) or all(word in userInput for word in lights_two):
getValue()
print ("Turning Off")
elif '#wiki' in userInput:
#keyword = '#wiki'
userInput1 = userInput.replace('#wiki', '')
print(userInput1)
print(wikipedia.summary(userInput1))
elif '#wolf' in userInput:
print("Just A Minute Sire")
userInput1 = userInput.replace('#wolf', '')
app_id="8442YL-RHPH7JGJPY"
client = wolframalpha.Client(app_id)
res = client.query(userInput1)
answer = next(res.results).text
print(answer)
elif '#help' in userInput:
print("#wiki for searching a wikipedia aritcle")
print("#wolf for solving a maths ques and for asking anyquestion")
print("#help for getting list of things i can do")
elif '#cls' in userInput:
tmp = sp.call('cls',shell=True)
else :
print("i dont get it boss")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment