diff --git a/Jarvis.py b/Jarvis.py index 02e4405..5b87554 100644 --- a/Jarvis.py +++ b/Jarvis.py @@ -114,19 +114,21 @@ def startTask(self): reply = random.choice(intent["responses"]) print(f"Reply:::=>{reply}") if "time" in reply: - NonInputExecution(reply) + NonInputExecution(reply, self) elif "date" in reply: - NonInputExecution(reply) + NonInputExecution(reply,self) elif "day" in reply: - NonInputExecution(reply) + NonInputExecution(reply,self) elif "wikipedia" in reply: InputExecution(reply, sentence) elif "google" in reply: InputExecution(reply, result) + elif "youtube" in reply: + InputExecution(reply, result) elif "joke" in reply: - NonInputExecution(reply) + NonInputExecution(reply, self) elif "weather" in reply: - NonInputExecution(reply) + NonInputExecution(reply, self) else: self.gui.speaker.setText(reply) Bol(reply) diff --git a/Task.py b/Task.py index d13b90b..9944769 100644 --- a/Task.py +++ b/Task.py @@ -1,8 +1,8 @@ from Speak import Bol import pyjokes import weather -# import datetime -from datetime import datetime +import datetime +# from datetime import datetime from PyQt5.QtCore import Qt, QTime, QDate def Time(): @@ -25,9 +25,8 @@ def Joke(): Bol(funny) -def NonInputExecution(query): +def NonInputExecution(query, ref = None): query = str(query) - if "time" in query: Time() elif "date" in query: @@ -37,7 +36,7 @@ def NonInputExecution(query): elif "joke" in query: Joke() elif "weather" in query: - weather.weathernews() + weather.weathernews(ref) def wishMe(): @@ -64,6 +63,7 @@ def showTime(self): def InputExecution(tag, query): + print("PU "+tag,query) if "wikipedia" in tag: name = str(query).replace("about", "").replace("wikipedia", "") import wikipedia @@ -76,7 +76,8 @@ def InputExecution(tag, query): query = str(query).replace("youtube", "") query = query.replace("on youtube", "") import pywhatkit - pywhatkit.search(query) + pywhatkit.playonyt(query) + elif "google" in tag: print("Googling...") diff --git a/data.pth b/data.pth index 05e1f5a..3bba062 100644 Binary files a/data.pth and b/data.pth differ diff --git a/weather.py b/weather.py index 6f110a2..402ec29 100644 --- a/weather.py +++ b/weather.py @@ -4,7 +4,7 @@ import geocoder g = geocoder.ip('me') -def weathernews(): +def weathernews(ref = None): api_url = "https://fcc-weather-api.glitch.me/api/current?lat=" + \ str(g.latlng[0]) + "&lon=" + str(g.latlng[1]) @@ -14,12 +14,16 @@ def weathernews(): main = data_json['main'] wind = data_json['wind'] weather_desc = data_json['weather'][0] + if ref is not None: + ref.gui.speaker.setText( + "The weather is " + weather_desc['description'] + " and the temperature is " + str( + main['temp']) + " degree celcius. The wind speed is " + str(wind['speed']) + " m/s") Bol('Current location is ' + data_json['name'] + data_json['sys']['country'] + 'dia') Bol('weather type ' + weather_desc['main']) Bol('Wind speed is ' + str(wind['speed']) + ' metre per second') Bol('Temperature: ' + str(main['temp']) + 'degree celcius') Bol('Humidity is ' + str(main['humidity'])) Bol(str(data_json['coord']['lat']) + 'latitude' + str(data_json['coord']['lon']) + 'longitude') - + if __name__ == '__main__': weathernews() \ No newline at end of file