Skip to content

Commit

Permalink
Merge pull request GauravSingh9356#22 from roshan9419/master
Browse files Browse the repository at this point in the history
Added Browser Opening for News
  • Loading branch information
GauravSingh9356 authored Oct 2, 2020
2 parents ca8815c + 93d5c97 commit faab401
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 20 additions & 2 deletions jarvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys
import smtplib
from news import speak_news
from news import speak_news, getNewsUrl
from diction import translate
from loc import weather
from youtube import you
Expand Down Expand Up @@ -168,7 +168,25 @@ def sendEmail(to, content):
elif 'news' in query:
speak('Ofcourse sir..')
speak_news()

speak('Do you want to read the full news...')
test = takeCommand()
if 'yes' in test:
speak('Ok Sir, Opening browser...)
webbrowser.open(getNewsUrl())
speak('You can now read the full news from this website.')
else:
speak('No Problem Sir')

elif 'voice' in query:
try:
if 'female' in query:
engine.setProperty('voice', voices[0].id)
else:
engine.setProperty('voice', voices[1].id)
speak("Hello Sir, I have switched my voice. How is it?")
except Exception as e:
pass

elif 'email to gaurav' in query:
try:
speak('What should I say?')
Expand Down
2 changes: 2 additions & 0 deletions news.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def speak_news():
speak('Moving on the next news headline..')
speak('These were the top headlines, Have a nice day Sir!!..')

def getNewsUrl():
return 'http://newsapi.org/v2/top-headlines?sources=the-times-of-india&apiKey=yourapikey'

if __name__ == '__main__':
speak_news()

0 comments on commit faab401

Please sign in to comment.