(self, interrupt=False)
Play the alarm sound. If specified, interrupts the currently playing song.
Play the alarm sound. If specified, interrupts the currently playing song.
Play the alarm sound . If specified interrupts the currently playing song .
def play_alarm(self, interrupt=False) -> None:
        """Play the alarm sound. If specified, interrupts the currently playing song."""
        redis.set("alarm_playing", True)
        lights_controller.alarm_started()
        self.playback_started.clear()

        with mopidy_command(important=True):
            # interrupt the current song if its playing
            if interrupt:
                self.player.tracklist.clear()
            self.player.tracklist.add(
                uris=[
                    "file://" + os.path.join(conf.BASE_DIR, "config/sounds/alarm.m4a")
                ]
            )
            self.player.playback.play()
        self.playback_started.wait(timeout=1)

        musiq.update_state()
        self.wait_until_song_end()

        lights_controller.alarm_stopped()
        redis.set("alarm_playing", False)

        if not interrupt:
            # if no song immediately continues playing, a manual state update is needed
            musiq.update_state()
def play_alarm ( self , interrupt = False ) -> None : redis . set ( "alarm_playing" , True ) lights_controller . alarm_started ( ) self . playback_started . clear ( ) with mopidy_command ( important = True ) : # interrupt the current song if its playing if interrupt : self . player . tracklist . clear ( ) self . player . tracklist . add ( uris = [ "file://" + os . path . join ( conf . BASE_DIR , "config/sounds/alarm.m4a" ) ] ) self . player . playback . play ( ) self . playback_started . wait ( timeout = 1 ) musiq . update_state ( ) self . wait_until_song_end ( ) lights_controller . alarm_stopped ( ) redis . set ( "alarm_playing" , False ) if not interrupt : # if no song immediately continues playing, a manual state update is needed musiq . update_state ( )