Skip to content

Commit

Permalink
Merge branch 'srizzling-other-improvements'
Browse files Browse the repository at this point in the history
  • Loading branch information
debugger22 committed May 12, 2014
2 parents 4413afa + 52a44f8 commit fa8e5be
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Dependencies can be installed by running this [pip](https://pypi.python.org/pypi
3. PyAudio
4. PyDub
5. Requests
6. PyYAML

Operating Systems
----------------
Expand Down
7 changes: 7 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config:
websites:
facebook: 'http://www.facebook.com'
twitter: 'http://www.twitter.com'
gmail: 'http://www.gmail.com'
youtube: 'http://www.youtube.com'
github: 'http://www.github.com'
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ PyAudio==0.2.8
pydub==0.9.1
requests==2.2.1
http://downloads.sourceforge.net/project/pyaiml/PyAIML%20%28unstable%29/0.8.6/PyAIML-0.8.6.zip
http://pyyaml.org/download/pyyaml/PyYAML-3.11.zip
35 changes: 14 additions & 21 deletions src/brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
import random
import urllib
import thread
import yaml

from src import google_tts
from src.wikipedia import wikipedia
from src import network
from src.some_functions import *
from src import common


speak_engine = google_tts.Google_TTS()

with open('config.yml', 'r') as f:
config = yaml.load(f)


class Brain():

Expand All @@ -21,26 +28,12 @@ class Brain():
def process(self, text):
words = text.lower().split(' ')
if 'open' in words:
if 'facebook' in words:
speak_engine.say("I'm on it. Stand By.")
webbrowser.open_new_tab("http://www.facebook.com")
return True
if 'google' in words:
speak_engine.say("I'm on it. Stand By.")
webbrowser.open_new_tab("http://www.google.com")
return True
if 'twitter' in words:
speak_engine.say("I'm on it. Stand By.")
webbrowser.open_new_tab("http://www.twitter.com")
return True
if 'gmail' in words:
speak_engine.say("I'm on it. Stand By.")
webbrowser.open_new_tab("http://mail.google.com")
return True
if 'youtube' in words:
speak_engine.say("I'm on it. Stand By.")
webbrowser.open_new_tab("http://www.youtube.com")
return True
speak_engine.say("I'm on it. Stand By.")
websites = config["config"]["websites"]
website_to_open = text[text.index('open') + 5:]
if website_to_open in websites:
url = websites[website_to_open]
webbrowser.open_new_tab(url)
if 'search' in words:
speak_engine.say("I'm looking for it. Please stand by!")
term_to_search = text[text.index('search') + 7:]
Expand All @@ -57,7 +50,7 @@ def process(self, text):
if 'a' in words and 'song' in words:
thread.start_new_thread(play_music, ())
return True
if 'current' in words and 'time' in words:
if 'current' in words and 'time' in words:
time = common.getCurrentTime()
speak_engine.say(time)
return True
Expand Down

0 comments on commit fa8e5be

Please sign in to comment.