Skip to content

Commit

Permalink
Merge pull request #92 from OpenVoiceOS/dev
Browse files Browse the repository at this point in the history
0.0.12
  • Loading branch information
JarbasAl authored Dec 28, 2023
2 parents 22627c5 + 654d8b4 commit b864210
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 142 deletions.
106 changes: 37 additions & 69 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,89 @@
# Changelog

## [V0.0.11a15](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a15) (2023-10-24)
## [V0.0.12a9](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a9) (2023-12-28)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a14...V0.0.11a15)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a8...V0.0.12a9)

**Merged pull requests:**

- Minor dependency and logging updates [\#77](https://github.com/OpenVoiceOS/ovos-config/pull/77) ([NeonDaniel](https://github.com/NeonDaniel))
- stable utils [\#91](https://github.com/OpenVoiceOS/ovos-config/pull/91) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a14](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a14) (2023-10-18)
## [V0.0.12a8](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a8) (2023-12-28)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a13...V0.0.11a14)

**Merged pull requests:**

- add max\_msg\_size [\#76](https://github.com/OpenVoiceOS/ovos-config/pull/76) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a13](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a13) (2023-09-18)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a12...V0.0.11a13)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a7...V0.0.12a8)

**Fixed bugs:**

- fix remote config reload [\#74](https://github.com/OpenVoiceOS/ovos-config/pull/74) ([emphasize](https://github.com/emphasize))
- drop mycroft-core config location [\#90](https://github.com/OpenVoiceOS/ovos-config/pull/90) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a12](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a12) (2023-09-17)
## [V0.0.12a7](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a7) (2023-12-28)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a10...V0.0.11a12)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a6...V0.0.12a7)

**Merged pull requests:**

- Fix typo'd "loosly" [\#72](https://github.com/OpenVoiceOS/ovos-config/pull/72) ([strugee](https://github.com/strugee))
- \[cache\] Add persistent cache options [\#68](https://github.com/OpenVoiceOS/ovos-config/pull/68) ([goldyfruit](https://github.com/goldyfruit))

## [V0.0.11a10](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a10) (2023-08-22)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a9...V0.0.11a10)

**Implemented enhancements:**

- Update default translation plugin [\#66](https://github.com/OpenVoiceOS/ovos-config/pull/66) ([JarbasAl](https://github.com/JarbasAl))
- fix instant listen inline doc [\#87](https://github.com/OpenVoiceOS/ovos-config/pull/87) ([emphasize](https://github.com/emphasize))

## [V0.0.11a9](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a9) (2023-08-08)
## [V0.0.12a6](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a6) (2023-12-27)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a8...V0.0.11a9)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a5...V0.0.12a6)

**Fixed bugs:**

- fix subclassing for deprecation [\#65](https://github.com/OpenVoiceOS/ovos-config/pull/65) ([JarbasAl](https://github.com/JarbasAl))
- fix circular import [\#89](https://github.com/OpenVoiceOS/ovos-config/pull/89) ([emphasize](https://github.com/emphasize))

## [V0.0.11a8](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a8) (2023-08-08)
**Closed issues:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a7...V0.0.11a8)
- Exception fetching remote configuration: No module named 'ovos\_backend\_client' [\#75](https://github.com/OpenVoiceOS/ovos-config/issues/75)

**Merged pull requests:**
## [V0.0.12a5](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a5) (2023-12-23)

- Log deprecation of FileWatcher classes in `.utils` [\#64](https://github.com/OpenVoiceOS/ovos-config/pull/64) ([NeonDaniel](https://github.com/NeonDaniel))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a4...V0.0.12a5)

## [V0.0.11a7](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a7) (2023-08-07)
**Fixed bugs:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a6...V0.0.11a7)
- fix/untangle\_from\_LF [\#88](https://github.com/OpenVoiceOS/ovos-config/pull/88) ([JarbasAl](https://github.com/JarbasAl))

**Implemented enhancements:**
## [V0.0.12a4](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a4) (2023-12-19)

- update config [\#63](https://github.com/OpenVoiceOS/ovos-config/pull/63) ([JarbasAl](https://github.com/JarbasAl))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a3...V0.0.12a4)

## [V0.0.11a6](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a6) (2023-07-26)
**Fixed bugs:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a5...V0.0.11a6)
- Force websocket to bind on 127.0.0.1 [\#86](https://github.com/OpenVoiceOS/ovos-config/pull/86) ([goldyfruit](https://github.com/goldyfruit))

**Merged pull requests:**
## [V0.0.12a3](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a3) (2023-12-07)

- Add config path checks before mtime checks [\#62](https://github.com/OpenVoiceOS/ovos-config/pull/62) ([NeonDaniel](https://github.com/NeonDaniel))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a2...V0.0.12a3)

## [V0.0.11a5](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a5) (2023-07-21)
**Implemented enhancements:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a4...V0.0.11a5)
- feat/lang\_utils [\#85](https://github.com/OpenVoiceOS/ovos-config/pull/85) ([JarbasAl](https://github.com/JarbasAl))

**Merged pull requests:**
## [V0.0.12a2](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a2) (2023-12-06)

- Fix infinitely recursive callback [\#61](https://github.com/OpenVoiceOS/ovos-config/pull/61) ([NeonDaniel](https://github.com/NeonDaniel))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.12a1...V0.0.12a2)

## [V0.0.11a4](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a4) (2023-07-13)
**Fixed bugs:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a3...V0.0.11a4)
- Update locale.py [\#84](https://github.com/OpenVoiceOS/ovos-config/pull/84) ([JarbasAl](https://github.com/JarbasAl))

**Closed issues:**

- Some fields not updating as expected using single command line [\#58](https://github.com/OpenVoiceOS/ovos-config/issues/58)

**Merged pull requests:**

- change connectivity check urls [\#60](https://github.com/OpenVoiceOS/ovos-config/pull/60) ([JarbasAl](https://github.com/JarbasAl))
- Lingua franca lang specific format module isn't loaded. [\#83](https://github.com/OpenVoiceOS/ovos-config/issues/83)
- Errors loading tts when mimic3-server is not installed [\#80](https://github.com/OpenVoiceOS/ovos-config/issues/80)

## [V0.0.11a3](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a3) (2023-07-04)
## [V0.0.12a1](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.12a1) (2023-11-05)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a2...V0.0.11a3)

**Implemented enhancements:**
[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11...V0.0.12a1)

- default g2p to ovos-g2p-plugin-heuristic-arpa [\#56](https://github.com/OpenVoiceOS/ovos-config/pull/56) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a2](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a2) (2023-07-04)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.11a1...V0.0.11a2)

**Implemented enhancements:**

- document dinkum listener [\#57](https://github.com/OpenVoiceOS/ovos-config/pull/57) ([JarbasAl](https://github.com/JarbasAl))

## [V0.0.11a1](https://github.com/OpenVoiceOS/ovos-config/tree/V0.0.11a1) (2023-07-02)
**Closed issues:**

[Full Changelog](https://github.com/OpenVoiceOS/ovos-config/compare/V0.0.10...V0.0.11a1)
- Invalid JSON Error [\#79](https://github.com/OpenVoiceOS/ovos-config/issues/79)

**Merged pull requests:**

- Update mycroft.conf [\#55](https://github.com/OpenVoiceOS/ovos-config/pull/55) ([JarbasAl](https://github.com/JarbasAl))
- removed deprecated mimic3 [\#81](https://github.com/OpenVoiceOS/ovos-config/pull/81) ([builderjer](https://github.com/builderjer))



Expand Down
87 changes: 76 additions & 11 deletions ovos_config/locale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dateutil.tz import gettz, tzlocal

import ovos_config

# lingua_franca is optional and might not be installed
Expand All @@ -14,10 +15,41 @@
_default_tz = None


def get_full_lang_code(lang):
""" given a 2-letter lang code, return the full default 4-letter code"""
# first give preference to any configured dialects
# eg, pt-br instead of pt-pt
valid_langs = get_valid_languages()
for l in valid_langs:
if l.split("-")[0] == lang:
return l

# just go with the default full code
langmap = {'az': 'az-az',
'ca': 'ca-es',
'cs': 'cs-cz',
'da': 'da-dk',
'de': 'de-de',
'en': 'en-us',
'es': 'es-es',
'eu': 'eu-eu',
'fa': 'fa-ir',
'fr': 'fr-fr',
'hu': 'hu-hu',
'it': 'it-it',
'nl': 'nl-nl',
'pl': 'pl-pl',
'pt': 'pt-pt',
'ru': 'ru-ru',
'sl': 'sl-si',
'sv': 'sv-se',
'tr': 'tr-tr',
'uk': 'uk-ua'}
return langmap.get(lang)


def get_primary_lang_code(config=None):
global _lang
if LF:
return LF.get_primary_lang_code()
if not _lang:
config = config or ovos_config.Configuration()
_lang = config.get("lang", "en-us")
Expand All @@ -31,20 +63,24 @@ def get_default_lang(config=None):
@return: lowercase BCP-47 language code
"""
global _lang
if LF and LF.get_default_loc():
return LF.get_default_loc()
if not _lang:
config = config or ovos_config.Configuration()
_lang = config.get("lang", "en-us")
return _lang


def set_default_lang(lang):
""" setup default language across OVOS packages
currently only configures lingua-franca language, in the future
other hooks may be added if we need to perform this operation globally"""
global _lang
_lang = lang
if LF:
LF.set_default_lang(lang)

try:
LF.set_default_lang(lang)
except:
pass

def get_config_tz():
code = ovos_config.Configuration()["location"]["timezone"]["code"]
Expand All @@ -57,7 +93,10 @@ def get_default_tz():


def set_default_tz(tz=None):
""" configure LF """
""" configure timezone across OVOS packages
currently only configures lingua-franca, in the future
other hooks may be added if we need to perform this operation globally """
global _default_tz
tz = tz or get_config_tz() or tzlocal()
_default_tz = tz
Expand All @@ -70,19 +109,45 @@ def set_default_tz(tz=None):


def load_languages(langs):
""" load and configure lang specific resources across OVOS packages
currently only loads lingua-franca language data, in the future
other hooks may be added if we need to perform this operation globally"""
if LF:
LF.load_languages(langs)
try:
LF.load_languages(langs)
except:
pass


def load_language(lang):
""" load and configure lang specific resources across OVOS packages
currently only loads lingua-franca language data, in the future
other hooks may be added if we need to perform this operation globally"""
if LF:
LF.load_language(lang)
try:
LF.load_language(lang)
except:
pass


def get_valid_languages():
""" return all valid runtime languages according to mycroft.conf """
lang_code = ovos_config.Configuration().get("lang", "en-us")
extra_lang_codes = ovos_config.Configuration().get("secondary_langs", [])
return set([lang_code] + extra_lang_codes)


def setup_locale(lang=None, tz=None):
""" setup default language, timezone and other locale data across OVOS packages
currently only configures lingua-franca, in the future
other hooks may be added if we need to perform this operation globally"""
lang_code = lang or ovos_config.Configuration().get("lang", "en-us")
# Load language resources, currently en-us must also be loaded at all times
load_languages([lang_code, "en-us"])
valid_langs = get_valid_languages()
# load any lang specific resources
load_languages(valid_langs)
# Set the active lang to match the configured one
set_default_lang(lang_code)
# Set the default timezone to match the configured one
Expand Down
15 changes: 1 addition & 14 deletions ovos_config/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,7 @@ def get_xdg_config_locations():


def find_default_config():
""" find where mycroft is installed and return the path to the default mycroft.conf
if mycroft is not found then return the bundled file in ovos_config package"""
from ovos_utils.system import search_mycroft_core_location
try:
mycroft_root = search_mycroft_core_location()
if not mycroft_root:
raise FileNotFoundError("Couldn't find mycroft core root folder.")
cfg = join(mycroft_root, "mycroft", "configuration", "mycroft.conf")
if isfile(cfg):
return cfg
except FileNotFoundError:
pass

# mycroft-core not found
"""return the bundled file in ovos_config package"""
return join(dirname(__file__), "mycroft.conf")


Expand Down
11 changes: 10 additions & 1 deletion ovos_config/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

import ovos_config.locations as _oloc
from ovos_utils.json_helper import load_commented_json, merge_dict
from ovos_utils.log import LOG


def get_ovos_config():
Expand Down Expand Up @@ -121,6 +120,8 @@ def get_ovos_default_config_paths():
eg. ["/etc/OpenVoiceOS/ovos.conf", "/home/user/.config/OpenVoiceOS/ovos.conf"]
"""
from ovos_utils.log import LOG

paths = []
if isfile("/etc/OpenVoiceOS/ovos.conf"):
paths.append("/etc/OpenVoiceOS/ovos.conf")
Expand All @@ -140,6 +141,8 @@ def get_ovos_default_config_paths():


def is_using_xdg():
from ovos_utils.log import LOG

""" BACKWARDS COMPAT: logs warning and always returns True"""
LOG.warning("is_using_xdg has been deprecated! XDG specs are always honoured, this method will be removed in a future release")
return True
Expand All @@ -163,6 +166,8 @@ def set_xdg_base(folder_name):
NOTE: this value will be set globally, per core overrides in ovos.conf take precedence
"""
from ovos_utils.log import LOG

LOG.info(f"XDG base folder set to: '{folder_name}'")
save_ovos_config({"base_folder": folder_name})

Expand All @@ -175,6 +180,8 @@ def set_config_filename(file_name, core_folder=None):
NOTE: this value will be set globally, per core overrides in ovos.conf take precedence
"""
from ovos_utils.log import LOG

if core_folder:
set_xdg_base(core_folder)
LOG.info(f"config filename set to: '{file_name}'")
Expand All @@ -198,6 +205,8 @@ def set_default_config(file_path=None):
NOTE: this value will be set globally, per core overrides in ovos.conf take precedence
"""
from ovos_utils.log import LOG

file_path = file_path or _oloc.find_default_config()
LOG.info(f"default config file changed to: {file_path}")
save_ovos_config({"default_config_path": file_path})
Loading

0 comments on commit b864210

Please sign in to comment.