def on_cmd_start(): """ Play a random voice of meeseeks when assistant switched to command mode """ aus = ["i'm mr meeseeks 2.wav", "i'm mr meeseeks.wav"] au = random.choice(aus) utils.play(au)
def timer(cmd, regexp): try: n = w2n.word_to_num(cmd) except ValueError: # No valid numeric words found! return False # The unit matched by regex pattern filter unit = regexp.groups()[0] secs = 0 for u, t in TIME_DURATION_UNITS: if u == unit: secs = n * t # without kitchen timer sound without_timer_sound = ("without" in cmd or "mute" in cmd) if TIMER_EVENT.is_set(): utils.tts('currently a timer is in progress') utils.tts('you can stop that by saying') utils.tts('stop timer') return False utils.play('oow okay.wav') Timer(seconds=secs, mute=without_timer_sound) return True
def _time_it_and_block(self): start_time = time.time() while (time.time() - start_time < self.seconds) and TIMER_EVENT.is_set(): if self.mute is True: time.sleep(1) else: utils.play("kitchen timer sound.wav")
def run(self): TIMER_EVENT.set() human_time = human_time_duration(self.seconds) time.sleep(0.5) utils.tts(f'timer for {human_time}' + ('without sound' if self.mute is True else '')) time.sleep(0.5) utils.tts('start') self._time_it_and_block() if TIMER_EVENT.is_set(): utils.play('ding.wav') TIMER_EVENT.clear()
def stop_cmd_mode(cmd): utils.play('oow okay.wav') assistant.stop_command_check() return True
def on_cmd_stop(): """ Play box sound when command mode stopped """ utils.play('box sound.wav')
def stop_timer(cmd): TIMER_EVENT.clear() utils.play("that's okay.wav") return True