Updated loudspeaker actuator
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-10-01 18:05:03 +02:00
parent 2fd833775a
commit a223c8e95e

View File

@ -21,12 +21,10 @@ class Loudspeaker(AbcActuator):
""" """
def __init__(self, sound_dir: str): def __init__(self, sound_dir: str):
BirbnetesIoTPlatformPlaybackDriver.init() BirbnetesIoTPlatformPlaybackDriver.init(sound_dir)
self._sound_dir = sound_dir
def act(self): def act(self):
choice = random.choice(os.listdir(self._sound_dir)) BirbnetesIoTPlatformPlaybackDriver.play_one_random()
BirbnetesIoTPlatformPlaybackDriver.play_audio(os.path.join(self._sound_dir, choice))
def __del__(self): def __del__(self):
BirbnetesIoTPlatformPlaybackDriver.cleanup() BirbnetesIoTPlatformPlaybackDriver.cleanup()