Beispiel #1
0
def main():
    """The entry point to kodi-addon-checker
    """
    load_plugins()
    parser = argparse.ArgumentParser(
        prog="kodi-addon-checker",
        description="Checks Kodi repo for best practices and creates \
                                     problem and warning reports.\r\nIf optional add-on \
                                     directories are provided, check only those add-ons. \
                                     Otherwise, scan current repository and check all add-ons in \
                                     the current directory.")
    parser.add_argument("--version",
                        action="version",
                        version="%(prog)s 0.0.1")
    parser.add_argument("add_on",
                        metavar="add-on",
                        type=dir_type,
                        nargs="*",
                        help="optional add-on directories")
    ConfigManager.fill_cmd_args(parser)
    args = parser.parse_args()

    repo_path = os.path.abspath(os.getcwd())
    config = Config(repo_path, args)
    ConfigManager.process_config(config)
    check_repo(config, repo_path, args.add_on)
Beispiel #2
0
def check_artifact(artifact_path, args, all_repo_addons):
    """
    Check given artifact and return its report. The artifact can be either an add-on or a repository.
    :param artifact_path: the path of add-on or repo
    :param args: argparse object
    :return: report
    """
    logger = logging.getLogger(__package__)
    logger.info("Downloading all repo addon list")
    logger.info("Download completed")
    artifact_path = os.path.abspath(artifact_path)
    config = Config(artifact_path, args)
    ConfigManager.process_config(config)
    if os.path.isfile(os.path.join(artifact_path, "addon.xml")):
        return check_addon.start(artifact_path, args, all_repo_addons, config)
    else:
        return check_repo(artifact_path, args, all_repo_addons, config)