def handle_read(text, mic, profile): mic.say(random.choice([ "I am contacting Apple. Please stand by.", "Opening that file. Please wait." ])) api = app_utils.iCloud(profile) rem = api.reminders listname = find_list(text, profile, rem) if not listname: mic.say(random.choice([ "I'm sorry, I couldn't find that list", "That list does not seem to be availble. Please check!" ])) return service = DateService() ans = random.choice([ "I've found the following entries: ", "Your " + listname + " list contains ", "These are the entries of the " + listname + " list " ]) for i in range(len(rem.lists[listname])): reminder = rem.lists[listname][i] ans += str(i+1) + ') ' + reminder['title'] if reminder['due']: ans += ', due at ' + service.convertTime(reminder['due']) ans += '.' ans += random.choice([ "", "That's it.", "There is nothing else on your list." ]) mic.say(ans)
def handle(query, mic, profile): mic.say(random.choice([ "I am looking for your device.", "I am paging your device" ])) api = app_utils.iCloud(profile) mic.say(get_device(query, profile, api))
def handle_write(text, mic, profile): mic.say(random.choice([ "I am contacting Apple. Please stand by.", "Opening that file. Please wait." ])) api = app_utils.iCloud(profile) rem = api.reminders listname = find_list(text, profile, rem) if not listname: return mic.say(random.choice([ "I have opened your %s list. What do you want to add?", "I was granted access to your %s list. What do you want me to add?" ]) % listname) timeouts = 0 while True: ans = mic.semiActiveListen(20, use_local=False) if not ans: mic.say(random.choice([ "Are you still there?", "Hello, paging %s. Are you there?" % (profile['first_name']), "%s, this is IRIS" % (profile['first_name']) ])) timeouts += 1 if timeouts == 2: mic.say("I'm closing this file..") return if app_utils.isNegative(ans): mic.say("Okay, I'm closing this file.") return if rem.post(ans, collection=listname): mic.say(random.choice([ "I've added it! ", "Done! " ])+random.choice([ "Anything else?" ])) else: mic.say(random.choice([ "I am sorry. I was not able to do that", "Apple did not grant me access to this" ]))