Skip to content

Commit

Permalink
slight refactor for ovos-utils 0.1.0 (#515)
Browse files Browse the repository at this point in the history
* slight refactor for ovos-utils 0.1.0

* feat: compat with ovos-utils 0.1.0
  • Loading branch information
mikejgray authored Apr 29, 2024
1 parent ca72863 commit d0dc08f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion neon_utils/skills/common_play_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

from neon_utils.skills.neon_skill import NeonSkill

from ovos_utils.skills.audioservice import AudioServiceInterface as AudioService
from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService


class CPSMatchLevel(Enum):
Expand Down
18 changes: 17 additions & 1 deletion neon_utils/skills/neon_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from ovos_utils.gui import is_gui_connected
from ovos_utils.skills import get_non_properties
from ovos_utils.xdg_utils import xdg_cache_home
from ovos_utils.skills.settings import save_settings, get_local_settings
from ovos_utils.log import deprecated, log_deprecation
from neon_utils.location_utils import to_system_time
from neon_utils.logger import LOG
Expand Down Expand Up @@ -76,6 +75,23 @@
DEFAULT_SPEED_MODE = "thoughtful"
CACHE_TIME_OFFSET = 24*60*60 # seconds in 24 hours

@deprecated("deprecated without replacement, skill settings no longer shipped in skill folder", "2.0.0")
def save_settings(skill_dir, skill_settings):
"""Save skill settings to file."""
if skill_dir.endswith("/settings.json"):
settings_path = skill_dir
else:
settings_path = os.path.join(skill_dir, 'settings.json')

settings = JsonStorage(settings_path)
for k, v in skill_settings.items():
settings[k] = v
try:
settings.store()
except Exception:
LOG.exception(f'error saving skill settings to {settings_path}')
else:
LOG.info(f'Skill settings successfully saved to {settings_path}')

class NeonSkill(OVOSSkill):
def __init__(self, name=None, bus=None, **kwargs):
Expand Down

0 comments on commit d0dc08f

Please sign in to comment.