def execute(self, operand): self.debug("Reminding " + operand) cmd = "play " + self.get_resource_path('ding.mp3') system.call_silently(cmd, sync=True) speech.say("Sir, " + operand, sync=False) response = inputs.get_string_timeout(self.get_config('TIME_OUT')) if not response: self.reschedule(operand) if meaning.means(response, "okay"): return elif meaning.means(response, "not_okay"): self.debug("Reminding again in one day.") reschedule_str = inputs.get_string("Schedule again in: ") try: delta = parse.time_delta(reschedule_str) except exceptions.PAULAParseException as e: outputs.print_error(str(e.__class__)) # fix bash issues again operand = operand.replace("\"", "\\\"") operand = operand.replace("\'", "\\\'") schedule.schedule_event_with_delta(delta, "paula_remind", operand) else: self.reschedule(operand)
def execute(self, operand): speech.say("How long do you think you will be gone, Sir?") answer = inputs.get_string() delta = parse.time_delta(answer) speech.say_all_from_file(self.get_resource_path('greetings.paula_says'), sync=True) sleep.go_to_sleep_mode(delta.seconds) answer = inputs.get_string_timeout(self.get_config('WAITING_TIME')) if not answer: sleep.go_to_sleep_mode(0) else: speech.say("Welcome back, Sir")
def check(self): """ Check every item on this checklist, according to the appropriate settings. """ if self.options["reversed"]: self.items.reverse() not_yet = [] for item in self.items: speech.say(item, sync=True) if not self.options["continuous"]: got_it = inputs.get_boolean() if not got_it: not_yet.append(item) if not_yet and not self.options["continuous"]: print("Left to get: " + " ".join(not_yet))
def execute(self, operand): speech.say("How long would you like to sleep, Sir?") option = inputs.get_item_from_dict(self.get_config('DURATION_OPTIONS')) # select song speech.say("Please select which song you want to wake you up.") s = song.choose() speech.say_random_from_file(self.get_resource_path('night.paula_says'), sync=True) # Set volume to something pleasant system_volume.set(self.get_config('PLEASANT_WAKE_UP_VOLUME')) # Sleep sleep.go_to_sleep_mode(int(option)) # Alarm go off speech.say_random_from_file(self.get_resource_path('morning.paula_says'), sync=True) now = datetime.datetime.now() hour_min = 'It is %H:%M' if now.hour < 9: hour_min += "in the morning." speech.say(now.strftime(hour_min), sync=True) month_day = "We are the %-d" day = now.day if day in self.get_config('DAY_SUFFIXES').keys(): month_day += self.get_config('DAY_SUFFIXES')[day] else: month_day += "th" month_day += ' %B %Y' speech.say(now.strftime(month_day), sync=True) subp = s.play() answer = inputs.get_string_timeout(self.get_config('WAKE_UP_TIME')) if not answer: # Wait until the song has finished subp.wait() try: subp.kill() except ProcessLookupError: pass speech.say_random_from_file(self.get_resource_path('up.paula_says')) # Show quote print((str(quote.get_random()))) # Get agenda for next few days agenda.print_default()
def coach(self, exercise, rest_duration, workout_list): """ Coaches the given scheme of the given exercise. @param exercise: The given exercise. @param rest_duration: The amount of rest between each set. @param workout_list: The list of reps in the sets. @return: """ for w in workout_list[:-1]: speech.say(str(w) + " " + exercise + ", Sir.") if not inputs.get_boolean(): speech.say("Done, Sir?") if inputs.get_boolean(): self.debug("Exiting.") return if not self.get_debug(): speech.say_random_from_file(self.get_resource_path('break.paula_says')) self.rest(rest_duration) speech.say("For the last set, do at least " + str(workout_list[-1]) + " " + exercise + ", Sir.") if not inputs.get_boolean(): speech.say("Too bad, Sir.") return speech.say_random_from_file(self.get_resource_path('done.paula_says'))
def execute(self, operand): self.debug("Saying " + operand) speech.say(operand, sync=True)