def execute(self, operand):
        if operand.strip() == "":
            outputs.print_error("Nothing to remind you of.")
            return

        if not "in" in operand: #TODO too hard coded?
            self.debug("no \"in\", Exiting.")
            return

        operand_parts = operand.split(" in ")
        content = " in ".join(operand_parts[:-1])
        moment = operand_parts[-1]

        if not " " in moment:
            self.debug("No space in moment, Exiting.")
            return

        try:
            delta = parse.time_delta(moment)
        except exceptions.PAULAParseException as e:
            outputs.print_error("An error occured while parsing the time delta.", error=e)
            return
        treated_content = self.treat_content(content)
        schedule.schedule_event_with_delta(delta, "paula_remind", treated_content)
        speech.say_random_from_file(self.get_resource_path('confirmation.paula_says'))
    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 reschedule(self, reminder):
     delta = parse.time_delta(self.get_config('AUTO_RESCHEDULE'))
     schedule.schedule_event_with_delta(delta, "paula_remind", reminder)