Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.12 #92

Merged
merged 29 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bc9be86
removed deprecated mimic3 (#81)
builderjer Nov 5, 2023
1421388
Increment Version to 0.0.12a1
JarbasAl Nov 5, 2023
5db2ab4
Update Changelog
JarbasAl Nov 5, 2023
e6105d4
Update locale.py (#84)
JarbasAl Dec 6, 2023
e2a26c6
Increment Version to 0.0.12a2
JarbasAl Dec 6, 2023
daa93f2
Update Changelog
JarbasAl Dec 6, 2023
1a1d209
feat/lang_utils (#85)
JarbasAl Dec 7, 2023
ecb55bb
Increment Version to 0.0.12a3
JarbasAl Dec 7, 2023
ceaf637
Update Changelog
JarbasAl Dec 7, 2023
ea8c6fe
Force websocket to bind on 127.0.0.1 (#86)
goldyfruit Dec 19, 2023
36d1a34
Increment Version to 0.0.12a4
JarbasAl Dec 19, 2023
ae24347
Update Changelog
JarbasAl Dec 19, 2023
f9ceb17
fix/untangle_from_LF (#88)
JarbasAl Dec 23, 2023
0d522b9
Increment Version to 0.0.12a5
JarbasAl Dec 23, 2023
4e520d6
Update Changelog
JarbasAl Dec 23, 2023
a835b22
fix circular import (#89)
emphasize Dec 27, 2023
96df7f9
Increment Version to 0.0.12a6
JarbasAl Dec 27, 2023
9e15714
Update Changelog
JarbasAl Dec 27, 2023
fc425c5
fix instant listen inline doc (#87)
emphasize Dec 28, 2023
89c2521
Increment Version to 0.0.12a7
JarbasAl Dec 28, 2023
6654199
Update Changelog
JarbasAl Dec 28, 2023
0b16d46
drop mycroft-core config location (#90)
JarbasAl Dec 28, 2023
fdd47fe
Increment Version to 0.0.12a8
JarbasAl Dec 28, 2023
bcb33f6
Update Changelog
JarbasAl Dec 28, 2023
e926ea5
stable utils (#91)
JarbasAl Dec 28, 2023
fc11739
Increment Version to 0.0.12a9
JarbasAl Dec 28, 2023
357ff61
Update Changelog
JarbasAl Dec 28, 2023
814bb2a
Increment Version to 0.0.12
JarbasAl Dec 28, 2023
654d8b4
Update Changelog
JarbasAl Dec 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading