Skip to content

Commit

Permalink
Fix check to make sure Playback thread is started once and only once (#…
Browse files Browse the repository at this point in the history
…148)

Add specific exception handling for trying to start a thread more than once

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Oct 27, 2023
1 parent 2a25fa9 commit 334bbb4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions neon_audio/tts/neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,11 @@ def _init_playback(self, playback_thread: NeonPlaybackThread = None):
TTS.playback.attach_tts(self)
if not TTS.playback.enclosure:
TTS.playback.enclosure = EnclosureAPI(self.bus)
if not TTS.playback.is_running:
TTS.playback.start()
if not TTS.playback.is_alive():
try:
TTS.playback.start()
except RuntimeError:
LOG.exception("Error starting the playback thread")

def _get_tts(self, sentence: str, request: dict = None, **kwargs):
# TODO: Signature should be made to match ovos-audio
Expand Down

0 comments on commit 334bbb4

Please sign in to comment.