Adds 2 new utilities, a method to auto generate the settingsmeta.json, useful for bootstraping when starting a skill, and a PrivateSettings class for skills to use, this applied as a patch for skills importing the base class from ovos_utils
I almost never provide the settingsmeta for privacy + buggy behaviour reasons, with this my skills will still provide a UI without mycroft messing things up
Usage
settings2meta
Here is an example from the video collection skill template
from ovos_utils.skills.settings import PrivateSettings
with PrivateSettings("testskill.jarbasai") as settings:
print(settings.path) # ~/.cache/json_database/testskill.jarbasai.json
settings["key"] = "value"
meta = settings.settingsmeta
# can be used for displaying in GUI
"""
{'skillMetadata': {'sections': [{'fields': [{'label': 'Key',
'name': 'key',
'type': 'text',
'value': 'value'}],
'name': 'testskill.jarbasai'}]}}
"""
# auto saved when leaving "with" context
# you can also manually call settings.store() if not using "with" context
or inside a skill
from ovos_utils.waiting_for_mycroft.base_skill import MycroftSkill
class MySkill(MycroftSkill):
"""
this is a skill with more functionality than base mycroft-core,
self.private_settings is NOT available in the __init__ method,
self.private_settings is NOT available if MycroftSkill is imported from mycroft-core instead of ovos_utils
"""
def initialize(self):
# reading data
my_secret = self.private_settings.get("secret")
# saving data
self.private_settings["password"] = "password1"
self.private_settings.store()
Adds 2 new utilities, a method to auto generate the
settingsmeta.json
, useful for bootstraping when starting a skill, and aPrivateSettings
class for skills to use, this applied as a patch for skills importing the base class from ovos_utilsThis allows basic usage of https://github.com/MycroftAI/mycroft-core/pull/2698 even if skills dont provide
settingsmeta.json
I almost never provide the settingsmeta for privacy + buggy behaviour reasons, with this my skills will still provide a UI without mycroft messing things up
Usage
settings2meta
Here is an example from the video collection skill template
outputs
PrivateSettings
can be used standalone
or inside a skill