diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad4593..84ec512 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/ovos_config/locale.py b/ovos_config/locale.py index 5214c56..65258af 100644 --- a/ovos_config/locale.py +++ b/ovos_config/locale.py @@ -1,4 +1,5 @@ from dateutil.tz import gettz, tzlocal + import ovos_config # lingua_franca is optional and might not be installed @@ -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") @@ -31,8 +63,6 @@ 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") @@ -40,11 +70,17 @@ def get_default_lang(config=None): 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"] @@ -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 @@ -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 diff --git a/ovos_config/locations.py b/ovos_config/locations.py index 5f80c58..fcfe712 100644 --- a/ovos_config/locations.py +++ b/ovos_config/locations.py @@ -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") diff --git a/ovos_config/meta.py b/ovos_config/meta.py index 54ec089..98be842 100644 --- a/ovos_config/meta.py +++ b/ovos_config/meta.py @@ -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(): @@ -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") @@ -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 @@ -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}) @@ -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}'") @@ -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}) diff --git a/ovos_config/mycroft.conf b/ovos_config/mycroft.conf index 16a3381..0980e35 100644 --- a/ovos_config/mycroft.conf +++ b/ovos_config/mycroft.conf @@ -331,7 +331,7 @@ // The mycroft-core messagebus websocket "websocket": { - "host": "0.0.0.0", + "host": "127.0.0.1", "port": 8181, "route": "/core", "ssl": false, @@ -481,10 +481,9 @@ "recording_timeout": 10.0, "recording_timeout_with_silence": 3.0, - // instant listen is an experimental setting, it removes the need for - // the pause between "hey mycroft" and starting to speak the utterance, - // this setting might slightly downgrade STT accuracy depending on engine used - "instant_listen": true, + // Skips all checks (eg. audio service confirmation) after the wake_word is recognized and + // instantly continues to listen for a command + "instant_listen": false, // continuous listen is an experimental setting, it removes the need for // wake words and uses VAD only, a streaming STT is strongly recommended @@ -607,7 +606,7 @@ "pulse_duck": false, // ovos tts server piper public servers by default, alan pope voice "module": "ovos-tts-plugin-server", - "fallback_module": "ovos-tts-plugin-mimic3-server", + "fallback_module": "", "ovos-tts-plugin-mimic": { "voice": "ap", // Add every new synth to the persistent cache (not cleared) @@ -619,17 +618,6 @@ "min_free_percent": 75, // How many times a utterance must be seen in order to be added to persistent cache "persist_thresh": 1 - }, - "ovos-tts-plugin-mimic3-server": { - // Add every new synth to the persistent cache (not cleared) - "persist_cache": false, - // Path to the persistent cached files, default will be $XDG_DATA_DIRS/mycroft/Mimic3ServerTTSPlugin - // (or respective TTS name) - "preloaded_cache": "", - // Curate the /tmp/tts cache if disk usage is above min % - "min_free_percent": 75, - // How many times a utterance must be seen in order to be added to persistent cache - "persist_thresh": 1 } }, diff --git a/ovos_config/version.py b/ovos_config/version.py index 3cb95cb..4e8dfb1 100644 --- a/ovos_config/version.py +++ b/ovos_config/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 0 -VERSION_BUILD = 11 +VERSION_BUILD = 12 VERSION_ALPHA = 0 # END_VERSION_BLOCK diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 3efd680..863f583 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,5 +1,5 @@ PyYAML>=5.4.0,<7.0.0 combo_lock~=0.2 python-dateutil~=2.6 -ovos-utils < 0.1.0 +ovos-utils >= 0.0.37 rich-click ~=1.6 diff --git a/test/unittests/test_locations.py b/test/unittests/test_locations.py index b8a890b..9a23c1a 100644 --- a/test/unittests/test_locations.py +++ b/test/unittests/test_locations.py @@ -60,36 +60,13 @@ def test_get_config_locations(self, config_path, webcache_loc, ['/test/default.yml', '/etc/test/test.yaml', 'webcache', '~/.test/test.yaml', 'config/test.yaml']) - @mock.patch("ovos_utils.system.search_mycroft_core_location") - def test_find_default_config(self, get_core): - from ovos_config.locations import find_default_config - - # No Core - get_core.return_value = None - no_core_default = find_default_config() - self.assertTrue(no_core_default.endswith("/ovos_config/mycroft.conf"), - no_core_default) - self.assertTrue(isfile(no_core_default), no_core_default) - - # # Invalid Core - # get_core.return_value = "/tmp" - # self.assertEqual(find_default_config(), - # "/tmp/mycroft/configuration/mycroft.conf") - - # Valid Core - get_core.return_value = dirname(__file__) - self.assertEqual(find_default_config(), - join(dirname(__file__), "mycroft", "configuration", - "mycroft.conf")) - - @mock.patch("ovos_utils.system.search_mycroft_core_location") + @mock.patch("ovos_config.meta.get_config_filename") @mock.patch("ovos_config.meta.get_xdg_base") @mock.patch("ovos_utils.system.is_running_from_module") @mock.patch("os.path.isfile") - def test_globals(self, fcheck, mod_check, xdg_base, config_filename, core_location): + def test_globals(self, fcheck, mod_check, xdg_base, config_filename): fcheck.return_value = True - core_location.return_value = "default/config/path" xdg_base.return_value = "test" config_filename.return_value = "test.yaml" mod_check.return_value = False @@ -111,9 +88,7 @@ def test_globals(self, fcheck, mod_check, xdg_base, config_filename, core_locati # Test all config paths respect environment overrides/configured values from ovos_config.locations import DEFAULT_CONFIG, SYSTEM_CONFIG, \ OLD_USER_CONFIG, USER_CONFIG, REMOTE_CONFIG, WEB_CONFIG_CACHE - self.assertEqual(DEFAULT_CONFIG, - "default/config/path/mycroft/configuration" - "/mycroft.conf") + self.assertEqual(SYSTEM_CONFIG, "mycroft/system/config") self.assertEqual(OLD_USER_CONFIG, expanduser("~/.test/test.yaml"))