Skip to content

Commit

Permalink
minor fixes and cleanup for consistency (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: jarbasai <[email protected]>
  • Loading branch information
NeonJarbas and JarbasAl authored Mar 14, 2022
1 parent a5b3feb commit b324247
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion ovos_plugin_manager/skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def load_skill_plugins(*args, **kwargs):
plugin_skills = []
plugins = find_skill_plugins()
for skill_id, plug in plugins.items():
skill = plug(*args, **kwargs)
try:
skill = plug(*args, **kwargs)
except:
LOG.exception(f"Failed to load {skill_id}")
continue
plugin_skills.append(skill)
return plugin_skills
3 changes: 2 additions & 1 deletion ovos_plugin_manager/stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def get_stt_config(config=None):
lang = config.get("lang", "en-us")
if "stt" in config:
config = config["stt"]
stt_module = config.get('module', 'google')
stt_module = config.get('module', 'dummy')
stt_config = config.get(stt_module, {})
stt_config["lang"] = stt_config.get('lang') or lang
stt_config["module"] = stt_module
return stt_config
12 changes: 7 additions & 5 deletions ovos_plugin_manager/templates/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,15 +789,17 @@ def load_phonemes(self, key):
return phoneme_file.load()

def stop(self):
try:
TTS.playback.stop()
except Exception as e:
pass
if TTS.playback:
try:
TTS.playback.stop()
except Exception as e:
pass
self.add_metric({"metric_type": "tts.stop"})

def shutdown(self):
self.stop()
TTS.playback.detach_tts(self)
if TTS.playback:
TTS.playback.detach_tts(self)

def __del__(self):
self.shutdown()
Expand Down
1 change: 1 addition & 0 deletions ovos_plugin_manager/vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ def get_vad_config(config=None):
config = config["VAD"]
vad_module = config.get('module') or 'dummy'
vad_config = config.get(vad_module, {})
vad_config["module"] = vad_module
return vad_config
5 changes: 2 additions & 3 deletions ovos_plugin_manager/wakewords.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ def get_class(hotword, config=None):

@staticmethod
def load_module(module, hotword, config, lang, loop):
LOG.info('Loading "{}" wake word via {}'.format(hotword, module))
LOG.info(f'Loading "{hotword}" wake word via {module}')
if module in OVOSWakeWordFactory.MAPPINGS:
module = OVOSWakeWordFactory.MAPPINGS[module]

clazz = load_wake_word_plugin(module)
if clazz is None:
raise ValueError(f'Wake Word plugin {module} not found')
LOG.info(
'Loaded the Wake Word plugin {}'.format(module))
LOG.info(f'Loaded the Wake Word plugin {module}')

return clazz(hotword, config, lang=lang)

Expand Down

0 comments on commit b324247

Please sign in to comment.