msm_wrapper.py
Go to the documentation of this file.
1 # Copyright 2019 Mycroft AI Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 
16 import os
17 from os.path import join, expanduser, exists
18 
19 from msm import MycroftSkillsManager, SkillRepo
20 from mycroft.util.combo_lock import ComboLock
21 
22 mycroft_msm_lock = ComboLock('/tmp/mycroft-msm.lck')
23 
24 
25 def create_msm(config):
26  """ Create msm object from config. """
27  msm_config = config['skills']['msm']
28  repo_config = msm_config['repo']
29  data_dir = expanduser(config['data_dir'])
30  skills_dir = join(data_dir, msm_config['directory'])
31  repo_cache = join(data_dir, repo_config['cache'])
32  platform = config['enclosure'].get('platform', 'default')
33 
34  with mycroft_msm_lock:
35  # Try to create the skills directory if it doesn't exist
36  if not exists(skills_dir):
37  os.makedirs(skills_dir)
38 
39  return MycroftSkillsManager(
40  platform=platform, skills_dir=skills_dir,
41  repo=SkillRepo(repo_cache, repo_config['url'],
42  repo_config['branch']),
43  versioned=msm_config['versioned'])
def get(phrase, lang=None, context=None)


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40