def install(method: str, skill: str, fuzzy: bool, no_ignore_case: bool, thresh: float, appstore: str, search: bool, branch: str, folder: str): if search: skills = search_skill(method, skill, fuzzy, no_ignore_case, thresh, appstore) elif not skill.startswith("http"): click.confirm('{s} does not look like a valid skill url, do you ' 'want to enable search?'.format(s=skill), abort=True) skills = search_skill(method, skill, fuzzy, no_ignore_case, thresh, appstore) else: skills = [SkillEntry.from_github_url(skill, branch)] if not len(skills): click.echo("NO RESULTS") else: # ask option prompt = "\nSearch Results:\n appstore - branch - url \n" opts = {} for s in skills: idx = len(opts) + 1 prompt += str(idx) + " - " + s.appstore + " - " + s.branch + " " +\ s.url + "\n" opts[idx] = s prompt += "0 - cancel installation\n" def ask_selection(): click.echo(prompt) value = click.prompt('Select an option', type=int) if value < 0 or value > len(opts): click.echo("Invalid choice") return ask_selection() return value value = ask_selection() if value == 0: click.echo("Installation cancelled") return skill = opts[value] skill_str = skill.branch + " " + skill.url click.confirm('Do you want to install {s} ?'.format(s=skill_str), abort=True) skill.install(folder)
from ovos_skills_manager import SkillEntry # from github url with json available (all urls work) url = "https://github.com/JarbasSkills/skill-wolfie/blob/master/__init__.py" url = "https://github.com/JarbasSkills/skill-wolfie/blob/v0.1/res/desktop/skill.json" url = "https://raw.githubusercontent.com/JarbasSkills/skill-wolfie/v0.1/res/desktop/skill.json" url = "https://github.com/JarbasSkills/skill-wolfie" s = SkillEntry.from_github_url(url) print(s.json) # from github url with no .json available url = "https://github.com/MycroftAI/skill-hello-world" s = SkillEntry.from_github_url(url) print(s.json) # from github url + implicit branch with json available url = "https://github.com/MycroftAI/skill-hello-world/tree/20.08" s = SkillEntry.from_github_url(url) print(s.json) # parse .json from github url to file (all urls work assuming json in standard location) url = "https://github.com/JarbasSkills/skill-wolfie/blob/master/__init__.py" url = "https://github.com/JarbasSkills/skill-wolfie" url = "https://raw.githubusercontent.com/JarbasSkills/skill-wolfie/v0.1/res/desktop/skill.json" url = "https://github.com/JarbasSkills/skill-wolfie/blob/v0.1/res/desktop/skill.json" s = SkillEntry.from_json(url) print(s.json) # parse .json from github url to file (json not available) url = "https://github.com/AIIX/youtube-skill" s = SkillEntry.from_json(url)
from ovos_skills_manager import SkillEntry skills_folder = "installed_skills" # skill requirements, branch not specified c url = "https://github.com/JarbasSkills/mycroft-node-red" s = SkillEntry.from_github_url(url, "master") updated = s.install(skills_folder) print("skill updated:", updated) # from github url + implicit branch with json available url = "https://github.com/MycroftAI/skill-hello-world/tree/20.08" s = SkillEntry.from_github_url(url) updated = s.install(skills_folder) print("skill updated:", updated) updated = s.update(skills_folder) print("skill updated:", updated) # test requirements.txt url = "https://github.com/JarbasSkills/skill-wolfie" s = SkillEntry.from_github_url(url) updated = s.install(skills_folder) print("skill updated:", updated) # test manifest.yml # NOTE most likely baresip install will fail because it needs sudo url = "https://github.com/JarbasSkills/skill-voip" s = SkillEntry.from_github_url(url) updated = s.install(skills_folder) print("skill updated:", updated)