From 2c55f4da462383ee6c7b89ea44e5c40cd5badf0c Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 23 Jul 2014 21:21:17 -0700 Subject: Google STT works on OS X --- client/modules/Notifications.py | 55 ----------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 client/modules/Notifications.py (limited to 'client/modules/Notifications.py') diff --git a/client/modules/Notifications.py b/client/modules/Notifications.py deleted file mode 100644 index fc91da1..0000000 --- a/client/modules/Notifications.py +++ /dev/null @@ -1,55 +0,0 @@ -import re -from facebook import * - - -WORDS = ["FACEBOOK", "NOTIFICATION"] - - -def handle(text, mic, profile): - """ - Responds to user-input, typically speech text, with a summary of - the user's Facebook notifications, including a count and details - related to each individual notification. - - Arguments: - text -- user-input, typically transcribed speech - mic -- used to interact with the user (for both input and output) - profile -- contains information related to the user (e.g., phone number) - """ - oauth_access_token = profile['keys']['FB_TOKEN'] - - graph = GraphAPI(oauth_access_token) - - try: - results = graph.request("me/notifications") - except GraphAPIError: - mic.say( - "I have not been authorized to query your Facebook. If you would like to check your notifications in the future, please visit the Jasper dashboard.") - return - except: - mic.say( - "I apologize, there's a problem with that service at the moment.") - - if not len(results['data']): - mic.say("You have no Facebook notifications. ") - return - - updates = [] - for notification in results['data']: - updates.append(notification['title']) - - count = len(results['data']) - mic.say("You have " + str(count) + - " Facebook notifications. " + " ".join(updates) + ". ") - - return - - -def isValid(text): - """ - Returns True if the input is related to Facebook notifications. - - Arguments: - text -- user-input, typically transcribed speech - """ - return bool(re.search(r'\bnotification|Facebook\b', text, re.IGNORECASE)) -- cgit v1.3.1