Skip to content

Commit

Permalink
Troubleshooting Neon overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Oct 11, 2023
1 parent 5f27a25 commit 9a13f9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion neon_audio/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def handle_speak(self, message):
message.context.setdefault("timing", dict())
message.context["timing"].setdefault("speech_start", time())
ident = message.data.get('speak_ident') or message.context.get('ident')
message.context['ident'] = ident
message.context['speak_ident'] = ident
if not ident:
LOG.warning(f"Ident missing for speak: {message.data}")

Expand Down
20 changes: 13 additions & 7 deletions neon_audio/tts/neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from ovos_bus_client.message import Message
from ovos_plugin_manager.language import OVOSLangDetectionFactory,\
OVOSLangTranslationFactory
from ovos_plugin_manager.templates.tts import TTS, PlaybackThread
from ovos_plugin_manager.templates.tts import TTS
from ovos_utils.enclosure.api import EnclosureAPI

from neon_utils.file_utils import encode_file_to_base64_string
Expand All @@ -44,7 +44,7 @@
from neon_utils.signal_utils import create_signal, check_for_signal,\
init_signal_bus
from ovos_utils.log import LOG, log_deprecation

from ovos_audio.playback import PlaybackThread
from ovos_config.config import Configuration


Expand Down Expand Up @@ -133,6 +133,7 @@ def get_requested_tts_languages(msg) -> list:

class NeonPlaybackThread(PlaybackThread):
def __init__(self, queue):
LOG.info("Initializing NeonPlaybackThread")
PlaybackThread.__init__(self, queue)

def begin_audio(self, message=None):
Expand Down Expand Up @@ -183,10 +184,13 @@ def _init_neon(base_engine, *args, **kwargs):
base_engine.lang = base_engine.lang or language_config.get("user",
"en-us")
try:
base_engine.lang_detector = \
OVOSLangDetectionFactory.create(language_config)
base_engine.translator = \
OVOSLangTranslationFactory.create(language_config)
if language_config.get('detection_module'):
# Prevent loading a detector if not configured
base_engine.lang_detector = \
OVOSLangDetectionFactory.create(language_config)
if language_config.get('translation_module'):
base_engine.translator = \
OVOSLangTranslationFactory.create(language_config)
except ValueError as e:
LOG.error(e)
base_engine.lang_detector = None
Expand All @@ -204,7 +208,9 @@ def _init_playback(self, playback_thread: NeonPlaybackThread = None):
# shutdown any previous thread
if TTS.playback:
TTS.playback.shutdown()

if not isinstance(playback_thread, NeonPlaybackThread):
LOG.exception("Received invalid playback_thread")
playback_thread = None
init_signal_bus(self.bus)
TTS.playback = playback_thread or NeonPlaybackThread(TTS.queue)
TTS.playback.set_bus(self.bus)
Expand Down

0 comments on commit 9a13f9b

Please sign in to comment.