Skip to content

Commit

Permalink
Merge pull request #7 from srizzling/time
Browse files Browse the repository at this point in the history
Gets current time and says it like 9:21 PM
  • Loading branch information
debugger22 committed May 12, 2014
2 parents f02611d + 5431591 commit 4413afa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions jarvis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import aiml
import sys
import traceback

from src import google_tts
from src import google_stt
from src import microphone
Expand Down
6 changes: 5 additions & 1 deletion src/brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from src.wikipedia import wikipedia
from src import network
from src.some_functions import *
from src import common
speak_engine = google_tts.Google_TTS()


Expand Down Expand Up @@ -56,7 +57,10 @@ 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:
time = common.getCurrentTime()
speak_engine.say(time)
return True
'''Handling Mathematical/Computational queries'''
if 'add' in words or 'subtract' in words or 'multiply' in words or 'divide' in words:
try:
Expand Down
5 changes: 5 additions & 0 deletions src/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import datetime

def getCurrentTime():
natural_date = datetime.datetime.now().strftime("%I %M %p")
return natural_date.lstrip('0')

0 comments on commit 4413afa

Please sign in to comment.