def setup(self): self.root = root = dirname(abspath(__file__)) self.msm = MycroftSkillsManager( platform='default', skills_dir=join(root, 'test-skills'), repo=SkillRepo( join(root, 'repo-instance'), branch='test-repo', url='https://github.com/mycroftai/mycroft-skills-manager'), versioned=True)
def __init__(self, args): msm = MycroftSkillsManager() skill_matches = [ skill for skill in msm.list() if skill.is_local and samefile(skill.path, args.skill_folder) ] if not skill_matches: raise NotUploaded( 'Skill at folder not uploaded to store: {}'.format( args.skill_folder)) self.skill = SkillData(skill_matches[0])
def setUp(self): temp_dir = tempfile.mkdtemp() self.temp_dir = Path(temp_dir) self.skills_json_path = self.temp_dir.joinpath('skills.json') self.skills_dir = self.temp_dir.joinpath('skills') self._build_fake_skills() self._mock_skills_json_path() self._mock_skill_entry() self._mock_skill_repo() copyfile('skills_test.json', str(self.skills_json_path)) self.msm = MycroftSkillsManager(platform='default', skills_dir=str( self.temp_dir.joinpath('skills')), repo=self.skill_repo_mock, versioned=True)
def create_msm(config): """ Create msm object from config. """ global mycroft_msm_lock if mycroft_msm_lock is None: try: mycroft_msm_lock = ComboLock('/tmp/mycroft-msm.lck') LOG.debug('mycroft-msm combo lock created') except Exception as e: LOG.error('Failed to create msm lock ({})'.format(repr(e))) msm_config = config['skills']['msm'] repo_config = msm_config['repo'] data_dir = expanduser(config['data_dir']) skills_dir = join(data_dir, msm_config['directory']) repo_cache = join(data_dir, repo_config['cache']) platform = config['enclosure'].get('platform', 'default') with mycroft_msm_lock: # Try to create the skills directory if it doesn't exist if not exists(skills_dir): os.makedirs(skills_dir) return MycroftSkillsManager(platform=platform, skills_dir=skills_dir, repo=SkillRepo(repo_cache, repo_config['url'], repo_config['branch']), versioned=msm_config['versioned'])
def main(): args = create_parser(usage).parse_args() github = load_github() summaries = {} repo = SkillRepo(path=join(gettempdir(), 'mycroft-skills-repo'), branch=use_branch) print("Working on repository: ", repo.url) print(" branch: ", repo.branch) for skill_entry in MycroftSkillsManager(repo=repo).list(): if not skill_entry.url: continue print('Generating {}...'.format(skill_entry.name)) try: summary = generate_summary(github, skill_entry) except GithubException as e: print('Failed to generate summary:', repr(e)) continue summaries[skill_entry.name] = summary if args.output_file: with open(args.output_file, 'w') as f: json.dump(summaries, f) else: print(json.dumps(summaries, indent=4)) if args.upload: upload_summaries(github, summaries, use_branch)
def before_all(context): log = create_voight_kampff_logger() bus = InterceptAllBusClient() bus_connected = Event() bus.once('open', bus_connected.set) create_daemon(bus.run_forever) context.msm = MycroftSkillsManager() # Wait for connection log.info('Waiting for messagebus connection...') bus_connected.wait() log.info('Waiting for skills to be loaded...') start = monotonic() while True: response = bus.wait_for_response(Message('mycroft.skills.all_loaded')) if response and response.data['status']: break elif monotonic() - start >= 2 * 60: raise Exception('Timeout waiting for skills to become ready.') else: sleep(1) context.bus = bus context.matched_message = None context.log = log
def create_msm(msm_config: MsmConfig) -> MycroftSkillsManager: """Returns an instantiated MSM object. This function is cached because it can take as long as 15 seconds to instantiate MSM. Caching the instance improves performance significantly, especially during the boot sequence when this function is called multiple times. """ if msm_config.repo_url != "https://github.com/MycroftAI/mycroft-skills": LOG.warning("You have enabled a third-party skill store.\n" "Unable to guarantee the safety of skills from " "sources other than the Mycroft Marketplace.\n" "Proceed with caution.") msm_lock = _init_msm_lock() LOG.info('Acquiring lock to instantiate MSM') with msm_lock: if not path.exists(msm_config.skills_dir): makedirs(msm_config.skills_dir) msm_skill_repo = SkillRepo(msm_config.repo_cache, msm_config.repo_url, msm_config.repo_branch) msm_instance = MycroftSkillsManager(platform=msm_config.platform, skills_dir=msm_config.skills_dir, repo=msm_skill_repo, versioned=msm_config.versioned) LOG.info('Releasing MSM instantiation lock.') return msm_instance
def main(): parser = ArgumentParser() parser.add_argument('-l', '--lang', default='en-us') parser.add_argument('-u', '--repo-url', help='Url of GitHub repo to upload skills to') parser.add_argument('-b', '--repo-branch', help='Branch of skills repo to upload to') parser.add_argument('-s', '--skills-dir', help='Directory to look for skills in') parser.add_argument('-c', '--repo-cache', help='Location to store local skills repo clone') parser.add_argument('-t', '--use-token', action='store_true') subparsers = parser.add_subparsers(dest='action') subparsers.required = True for action, cls in console_actions.items(): cls.register(subparsers.add_parser(action)) args = parser.parse_args(sys.argv[1:]) context = GlobalContext() context.lang = args.lang context.msm = MycroftSkillsManager( skills_dir=args.skills_dir, repo=SkillRepo(url=args.repo_url, branch=args.repo_branch) ) context.use_token = args.use_token context.branch = context.msm.repo.branch try: return console_actions[args.action](args).perform() except MskException as e: print('{}: {}'.format(e.__class__.__name__, str(e))) except (KeyboardInterrupt, EOFError): pass
def create_msm(msm_config: MsmConfig) -> MycroftSkillsManager: """Returns an instantiated MSM object. This function is cached because it can take as long as 15 seconds to instantiate MSM. Caching the instance improves performance significantly, especially during the boot sequence when this function is called multiple times. """ msm_lock = _init_msm_lock() LOG.info('Acquiring lock to instantiate MSM') with msm_lock: if not path.exists(msm_config.skills_dir): makedirs(msm_config.skills_dir) msm_skill_repo = SkillRepo( msm_config.repo_cache, msm_config.repo_url, msm_config.repo_branch ) msm_instance = MycroftSkillsManager( platform=msm_config.platform, skills_dir=msm_config.skills_dir, repo=msm_skill_repo, versioned=msm_config.versioned ) LOG.info('Releasing MSM instantiation lock.') return msm_instance
def create_msm(): config = Configuration.get() msm_config = config['skills']['msm'] repo_config = msm_config['repo'] platform = config['enclosure'].get('platform', 'default') return MycroftSkillsManager(platform=platform, skills_dir=msm_config['directory'], repo=SkillRepo(repo_config['cache'], repo_config['url'], repo_config['branch']), versioned=msm_config['versioned'])
def create_skills_manager(platform, skills_dir, url, branch): """Create mycroft skills manager for the given url / branch. Args: platform (str): platform to use skills_dir (str): skill directory to use url (str): skills repo url branch (str): skills repo branch Returns: MycroftSkillsManager """ repo = SkillRepo(url=url, branch=branch) return MycroftSkillsManager(platform, skills_dir, repo)
def create_msm(): config = Configuration.get() msm_config = config['skills']['msm'] repo_config = msm_config['repo'] data_dir = expanduser(config['data_dir']) skills_dir = join(data_dir, msm_config['directory']) # Try to create the skills directory if it doesn't exist if not exists(skills_dir): os.makedirs(skills_dir) repo_cache = join(data_dir, repo_config['cache']) platform = config['enclosure'].get('platform', 'default') return MycroftSkillsManager(platform=platform, skills_dir=skills_dir, repo=SkillRepo(repo_cache, repo_config['url'], repo_config['branch']), versioned=msm_config['versioned'])
def main(): parser = ArgumentParser() parser.add_argument('-l', '--lang', default='en-us') parser.add_argument('-u', '--repo-url', help='Url of GitHub repo to upload skills to') parser.add_argument('-b', '--repo-branch', help='Branch of skills repo to upload to') parser.add_argument('-s', '--skills-dir', help='Directory to look for skills in') parser.add_argument('-c', '--repo-cache', help='Location to store local skills repo clone') subparsers = parser.add_subparsers(dest='action') subparsers.required = True action_to_cls = {} for cls, names in action_names.items(): cls.register(subparsers.add_parser(names[0], aliases=names[1:])) action_to_cls.update({name: cls for name in names}) args = parser.parse_args(sys.argv[1:]) ensure_git_user() context = GlobalContext() context.lang = args.lang context.msm = MycroftSkillsManager(skills_dir=args.skills_dir, repo=SkillRepo(url=args.repo_url, branch=args.repo_branch, path=args.repo_cache)) context.branch = context.msm.repo.branch try: return action_to_cls[args.action](args).perform() except MskException as e: print('{}: {}'.format(e.__class__.__name__, str(e))) except (KeyboardInterrupt, EOFError): pass
def before_all(context): log = create_voight_kampff_logger() bus = InterceptAllBusClient() bus_connected = Event() bus.once('open', bus_connected.set) create_daemon(bus.run_forever) context.msm = MycroftSkillsManager() # Wait for connection log.info('Waiting for messagebus connection...') bus_connected.wait() log.info('Waiting for skills to be loaded...') start = monotonic() while True: response = bus.wait_for_response(Message('mycroft.skills.all_loaded')) if response and response.data['status']: break elif monotonic() - start >= 2 * 60: raise Exception('Timeout waiting for skills to become ready.') else: sleep(1) # Temporary bugfix - First test to run sometimes fails # Sleeping to see if something isn't finished setting up when tests start # More info in Jira Ticket MYC-370 # TODO - remove and fix properly dependant on if failures continue sleep(10) context.bus = bus context.matched_message = None context.log = log context.original_config = {} context.config = Configuration.get() Configuration.set_config_update_handlers(bus)
class TestMycroftSkillsManager(object): def setup(self): self.root = root = dirname(abspath(__file__)) self.msm = MycroftSkillsManager( platform='default', skills_dir=join(root, 'test-skills'), repo=SkillRepo( join(root, 'repo-instance'), branch='test-repo', url='https://github.com/mycroftai/mycroft-skills-manager'), versioned=True) def teardown(self): if exists(self.msm.skills_dir): rmtree(self.msm.skills_dir) if exists(self.msm.repo.path): rmtree(self.msm.repo.path) def test_install(self): """Install by url or name""" self.msm.install('skill-a') with pytest.raises(AlreadyInstalled): self.msm.install('skill-a') self.msm.install('skill-b') def test_remove(self): """Remove by url or name""" with pytest.raises(AlreadyRemoved): self.msm.remove('skill-a') self.msm.install('skill-a') self.msm.remove('skill-a') def test_update(self): """Update all downloaded skills""" self.msm.install('skill-a') self.msm.update() def test_install_defaults(self): """Installs the default skills, updates all others""" assert not self.msm.find_skill('skill-a').is_local self.msm.install_defaults() assert self.msm.find_skill('skill-a').is_local assert not self.msm.find_skill('skill-b').is_local self.msm.platform = 'platform-1' self.msm.install_defaults() assert self.msm.find_skill('skill-b').is_local def test_list(self): all_skills = {'skill-a', 'skill-b', 'skill-cd', 'skill-ce'} assert {i.name for i in self.msm.list()} == all_skills def test_find_skill(self): with pytest.raises(MultipleSkillMatches): self.msm.find_skill('skill-c') with pytest.raises(SkillNotFound): self.msm.find_skill('jsafpcq')
from mycroft.util.audio_utils import play_wav, play_mp3 from os.path import join import time from os.path import dirname, exists, expanduser from os import makedirs, access, W_OK import json try: import cv2 from imutils.video import VideoStream #from shared_camera import Camera import yagmail except ImportError: # re-install yourself from msm import MycroftSkillsManager msm = MycroftSkillsManager() msm.install_by_url("https://github.com/emphasize/skill-camera", True) # trigger reload msm.reload_skill("skill-camera") __author__ = 'jarbas' class WebcamSkill(MycroftSkill): def __init__(self): self.create_settings_meta() super(WebcamSkill, self).__init__() platform = self.config_core.get("enclosure", {}) \ .get("platform", "unknown") self.use_pi = platform.lower() in [ "mycroft_mark_2", "mycroft_mark_1", "picroft", "unknown",
from mycroft.util.log import LOG from websocket import create_connection from .file_path_manager import FilePathManager LOG.warning('Skill Keypad is Running ') try: from .code.keypad import Keypad from mycroft.messagebus.client.ws import WebsocketClient from mycroft.messagebus.message import Message except ImportError: # re-install yourself from msm import MycroftSkillsManager msm = MycroftSkillsManager() msm.install("https://github.com/ITE-5th/skill-keypad") sleep_time = 1 class KeypadSkill(MycroftSkill): def __init__(self): super(KeypadSkill, self).__init__("ImageCaptionSkill") self.keypad_client = Keypad() self.keypad_client.start(self.keypad_callback) self.last_msg_time = 0 @staticmethod def callback_fn(command): try:
class TestMycroftSkillsManager(TestCase): def setUp(self): temp_dir = tempfile.mkdtemp() self.temp_dir = Path(temp_dir) self.skills_json_path = self.temp_dir.joinpath('skills.json') self.skills_dir = self.temp_dir.joinpath('skills') self._build_fake_skills() self._mock_skills_json_path() self._mock_skill_entry() self._mock_skill_repo() copyfile('skills_test.json', str(self.skills_json_path)) self.msm = MycroftSkillsManager(platform='default', skills_dir=str( self.temp_dir.joinpath('skills')), repo=self.skill_repo_mock, versioned=True) def _build_fake_skills(self): foo_skill_dir = self.skills_dir.joinpath('skill-foo') foo_skill_dir.mkdir(parents=True) foo_skill_dir.joinpath('__init__.py').touch() bar_skill_dir = self.skills_dir.joinpath('skill-bar') bar_skill_dir.mkdir(parents=True) bar_skill_dir.joinpath('__init__.py').touch() def _mock_log(self): log_patch = patch('msm.mycroft_skills_manager.LOG') self.addCleanup(log_patch.stop) self.log_mock = log_patch.start() def _mock_skills_json_path(self): expanduser_patch = patch('msm.skill_state.expanduser') self.addCleanup(expanduser_patch.stop) self.skills_json_path_mock = expanduser_patch.start() self.skills_json_path_mock.return_value = str( self.temp_dir.joinpath('skills.json')) def _mock_skill_entry(self): skill_entry_patch = patch( 'msm.mycroft_skills_manager.SkillEntry.install', spec=True) self.addCleanup(skill_entry_patch.stop) self.skill_entry_mock = skill_entry_patch.start() def _mock_skill_repo(self): skill_repo_patch = patch('msm.mycroft_skills_manager.SkillRepo', spec=True) self.addCleanup(skill_repo_patch.stop) self.skill_repo_mock = skill_repo_patch.start() self.skill_repo_mock.skills_meta_info = {'https://skill_foo_url': None} def teardown(self): rmtree(str(self.temp_dir)) def test_device_skill_state(self): """Contents of skills.json are loaded into memory""" state = self.msm.device_skill_state initial_state = [ dict(name='skill-foo', origin='default', beta=False, status='active', installed=12345, updated=0, installation='installed', skill_gid='@|skill-foo'), dict(name='skill-bar', origin='default', beta=False, status='active', installed=23456, updated=0, installation='installed', skill_gid='@|skill-bar') ] self.assertListEqual(initial_state, state['skills']) self.assertListEqual([], state['blacklist']) self.assertEqual(2, state['version']) new_hash = device_skill_state_hash(self.msm.device_skill_state) self.assertEqual(new_hash, self.msm.device_skill_state_hash) def test_build_device_skill_state(self): """No skill.json file so build one.""" os.remove(str(self.skills_json_path)) self.msm._device_skill_state = None self.msm._init_skills_data() state = self.msm.device_skill_state initial_state = [ dict(name='skill-bar', origin='non-msm', beta=False, status='active', installed=0, updated=0, installation='installed', skill_gid='@|skill-bar'), dict(name='skill-foo', origin='non-msm', beta=False, status='active', installed=0, updated=0, installation='installed', skill_gid='@|skill-foo') ] self.assertTrue(self.skills_json_path.exists()) with open(self.skills_json_path) as skills_json: device_skill_state = json.load(skills_json) self.assertListEqual(initial_state, state['skills']) self.assertListEqual(initial_state, device_skill_state['skills']) self.assertListEqual([], state['blacklist']) self.assertListEqual([], device_skill_state['blacklist']) self.assertEqual(2, state['version']) self.assertEqual(2, device_skill_state['version']) new_hash = device_skill_state_hash(self.msm.device_skill_state) self.assertEqual(new_hash, self.msm.device_skill_state_hash) def test_remove_from_device_skill_state(self): """Remove a file no longer installed from the device's skill state. Delete skill-bar from the local skills. This should trigger it being removed from the device skill state. """ del (self.msm.local_skills['skill-bar']) self.msm._device_skill_state = None state = self.msm.device_skill_state initial_state = [ dict(name='skill-foo', origin='default', beta=False, status='active', installed=12345, updated=0, installation='installed', skill_gid='@|skill-foo') ] self.assertListEqual(initial_state, state['skills']) self.assertListEqual([], state['blacklist']) self.assertEqual(2, state['version']) def test_skill_list(self): """The skill.list() method is called.""" all_skills = self.msm.list() skill_names = [skill.name for skill in all_skills] self.assertIn('skill-foo', skill_names) self.assertIn('skill-bar', skill_names) self.assertEqual(2, len(all_skills)) self.assertIsNone(self.msm._local_skills) self.assertIsNone(self.msm._default_skills) self.assertEqual(all_skills, self.msm._all_skills) def test_install(self): """Install a skill Test that the install method was called on the skill being installed and that the new skill was added to the device's skill state. """ skill_to_install = self.skill_entry_mock() skill_to_install.name = 'skill-test' skill_to_install.skill_gid = 'test-skill|99.99' skill_to_install.is_beta = False with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True with patch('msm.mycroft_skills_manager.time') as time_mock: time_mock.time.return_value = 100 self.msm.install(skill_to_install, origin='voice') with open(self.skills_json_path) as skills_json: device_skill_state = json.load(skills_json) skill_test_state = dict(name='skill-test', origin='voice', beta=False, status='active', installed=100, updated=0, installation='installed', skill_gid='test-skill|99.99') self.assertIn(skill_test_state, device_skill_state['skills']) self.assertListEqual([call.install(None)], skill_to_install.method_calls) def test_already_installed(self): """Attempt install of skill already on the device. When this happens, an AlreadyInstalled exception is raised and the device skill state is not modified. """ skill_to_install = self.skill_entry_mock() skill_to_install.name = 'skill-foo' skill_to_install.skill_gid = 'skill-foo|99.99' skill_to_install.is_beta = False skill_to_install.install = Mock(side_effect=AlreadyInstalled()) pre_install_hash = device_skill_state_hash(self.msm.device_skill_state) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True with self.assertRaises(AlreadyInstalled): self.msm.install(skill_to_install) self.assertIsNotNone(self.msm._local_skills) self.assertIn('all_skills', self.msm._cache) post_install_hash = device_skill_state_hash( self.msm.device_skill_state) self.assertEqual(pre_install_hash, post_install_hash) def test_install_failure(self): """Install attempt fails for whatever reason When an install fails, the installation will raise a MsmException. The skill install will be saved to the device skill state as failed and the error that caused the exception will be included in the state. """ skill_to_install = self.skill_entry_mock() skill_to_install.name = 'skill-test' skill_to_install.skill_gid = 'skill-test|99.99' skill_to_install.is_beta = False skill_to_install.install = Mock(side_effect=MsmException('RED ALERT!')) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True self.msm.install(skill_to_install, origin='cli') with open(self.skills_json_path) as skills_json: device_skill_state = json.load(skills_json) skill_test_state = dict(name='skill-test', origin='cli', beta=False, status='error', installed=0, updated=0, installation='failed', skill_gid='skill-test|99.99', failure_message='RED ALERT!') self.assertIn(skill_test_state, self.msm.device_skill_state['skills']) self.assertIn(skill_test_state, device_skill_state['skills']) self.assertListEqual([call.install(None)], skill_to_install.method_calls) def test_remove(self): """Remove a skill Test that the remove method was called on the skill being installed and that the new skill was removed from the device's skill state. """ skill_to_remove = self.skill_entry_mock() skill_to_remove.name = 'skill-foo' pre_install_hash = device_skill_state_hash(self.msm.device_skill_state) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True self.msm.remove(skill_to_remove) with open(self.skills_json_path) as skills_json: device_skill_state = json.load(skills_json) skill_names = [skill['name'] for skill in device_skill_state['skills']] self.assertNotIn('skill_foo', skill_names) skill_names = [ skill['name'] for skill in self.msm.device_skill_state['skills'] ] self.assertNotIn('skill_foo', skill_names) self.assertListEqual([call.remove()], skill_to_remove.method_calls) self.assertNotIn('all_skills', self.msm._cache) self.assertIsNone(self.msm._local_skills) post_install_hash = device_skill_state_hash( self.msm.device_skill_state) self.assertNotEqual(pre_install_hash, post_install_hash) def test_already_removed(self): """Attempt removal of skill already removed from the device. When this happens, an AlreadyRemoved exception is raised and the device skill state is not modified. """ skill_to_remove = self.skill_entry_mock() skill_to_remove.name = 'skill-foo' skill_to_remove.remove = Mock(side_effect=AlreadyRemoved()) pre_install_hash = device_skill_state_hash(self.msm.device_skill_state) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True self.msm.remove(skill_to_remove) self.assertListEqual([call.remove()], skill_to_remove.method_calls) self.assertIsNotNone(self.msm._local_skills) self.assertIn('all_skills', self.msm._cache) post_install_hash = device_skill_state_hash( self.msm.device_skill_state) self.assertEqual(pre_install_hash, post_install_hash) def test_remove_failure(self): """Skill removal attempt fails for whatever reason When n removal fails, a MsmException is raised. The removal will not be saved to the device skill state. """ skill_to_remove = self.skill_entry_mock() skill_to_remove.name = 'skill-test' skill_to_remove.remove = Mock(side_effect=MsmException('RED ALERT!')) pre_install_hash = device_skill_state_hash(self.msm.device_skill_state) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True with self.assertRaises(MsmException): self.msm.remove(skill_to_remove) self.assertListEqual([call.remove()], skill_to_remove.method_calls) self.assertIsNotNone(self.msm._local_skills) self.assertIn('all_skills', self.msm._cache) post_install_hash = device_skill_state_hash( self.msm.device_skill_state) self.assertEqual(pre_install_hash, post_install_hash) def test_update(self): """Remove a skill Test that the remove method was called on the skill being installed and that the new skill was removed from the device's skill state. """ skill_to_update = self.skill_entry_mock() skill_to_update.name = 'skill-foo' skill_to_update.is_beta = False pre_install_hash = device_skill_state_hash(self.msm.device_skill_state) with patch('msm.mycroft_skills_manager.time') as time_mock: time_mock.time.return_value = 100 self.msm.update(skill_to_update) with open(self.skills_json_path) as skills_json: device_skill_state = json.load(skills_json) skill_names = [skill['name'] for skill in device_skill_state['skills']] self.assertIn('skill-foo', skill_names) for skill in self.msm.device_skill_state['skills']: if skill['name'] == 'skill-foo': self.assertEqual(100, skill['updated']) self.assertListEqual([call.update()], skill_to_update.method_calls) self.assertNotIn('all_skills', self.msm._cache) self.assertIsNone(self.msm._local_skills) post_install_hash = device_skill_state_hash( self.msm.device_skill_state) self.assertNotEqual(pre_install_hash, post_install_hash)
from .code.misc.camera import Camera from .code.misc.http.api import get_http_request_type, request_http from .code.misc.receiver import Receiver from .code.misc.sender import Sender from .default_config import DefaultConfig LOG.warning('Running Skill Face Recognizer On Python ' + sys.version) try: import picamera from googletrans import Translator except ImportError: # re-install yourself from msm import MycroftSkillsManager msm = MycroftSkillsManager() msm.install("https://github.com/ITE-5th/skill-face-recognizer") class FaceRecognizerSkill(MycroftSkill): def __init__(self): super(FaceRecognizerSkill, self).__init__(name="FaceRecognizerSkill") LOG.warning('Running Skill Face Recognizer') # if "server_url" not in self.settings: # self.settings["server_url"] = DefaultConfig.server_url self.user_name = None self.socket = None self.receiver = None self.sender = None self.port = None
def handle_search_skills_intent(self, message): # A decision was made other than Cancel m = MycroftSkillsManager() installed_skills = [s for s in m.list() if s.is_local] LOGGER.info('Found the following Skills: '+str(installed_skills))
from .code.misc.camera import Camera from .code.misc.receiver import Receiver from .code.misc.sender import Sender from .default_config import DefaultConfig # TODO: Make sure "." before module name is not missing LOG.warning('Running Skill Image Captioning On Python ' + sys.version) try: import picamera except ImportError: # re-install yourself from msm import MycroftSkillsManager msm = MycroftSkillsManager() msm.install("https://github.com/ITE-5th/skill-image-caption") class ImageCaptionSkill(MycroftSkill): def __init__(self): super(ImageCaptionSkill, self).__init__("ImageCaptionSkill") LOG.warning('Running Skill Image Captioning ') # if "server_url" not in self.settings: # self.settings["server_url"] = "192.168.43.243" # TODO resize image according to specific network self.socket = None self.receiver = None self.sender = None