Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
fix/bad_configs
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 17, 2022
1 parent 591a69c commit 462ef68
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions ovos_local_backend/database/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ def deserialize(data):
else:
val = False
elif t == "number":
val = float(val)
if val == "False":
val = 0
elif val == "True":
val = 1
else:
val = float(val)
elif val.lower() in ["none", "null", "nan"]:
val = None
elif val == "[]":
Expand Down Expand Up @@ -166,9 +171,19 @@ def selene_settings(self):
# NOTE - selene returns the full listener config
# this SHOULD NOT be done, since backend has no clue of hardware downstream
# we return only wake word config
ww_cfg = {self.default_ww: self.default_ww_cfg}
if self.default_ww and self.default_ww_cfg:
ww_cfg = {self.default_ww: self.default_ww_cfg}
listener = {"wakeWord": self.default_ww.replace(" ", "_")}
else:
ww_cfg = {}
listener = {}

tts_config = dict(self.default_tts_cfg)
tts = tts_config.pop("module")
if "module" in tts_config:
tts = tts_config.pop("module")
tts_settings = {"module": tts, tts: tts_config}
else:
tts_settings = {}
return {
"dateFormat": self.date_format,
"optIn": self.opt_in,
Expand All @@ -177,9 +192,9 @@ def selene_settings(self):
"uuid": self.uuid,
"lang": self.lang,
"location": self.location,
"listenerSetting": {"wakeWord": self.default_ww.replace(" ", "_")},
"listenerSetting": listener,
"hotwordsSetting": ww_cfg, # not present in selene, parsed correctly by core
'ttsSettings': {"module": tts, tts: tts_config}
'ttsSettings': tts_settings
}

def serialize(self):
Expand Down

0 comments on commit 462ef68

Please sign in to comment.