This is a PHP application that can be used to generate a badge for your Kodi addon using the Shields.io JSON endpoint syntax. The result is badge you can include with your Kodi addon so people know at a glance what versions of Kodi your addon will run on.
When queried the application will pull the addon.xml
file of your addon from it's repository and calculate the compatible Kodi versions based on the official Kodi compatibility matrix.
Please note: this script assumes your project is hosted on Github and is the only project in a given repo, with the addon.xml file in the root of the project folder. I've noticed this is the setup for most Kodi addons
You can install this script on any webserver that runs PHP using composer. It does use the Simple XML library for reading in the addon.xml
file of your project so the correct Kodi version can be determined. A sample Apache .htaccess
file using mod_rewrite is given, for other server configurations PRs are accepted!
In the src/index.php
file the following variables needed to be modified to fit your server setup:
//MODIFY THESE TO MATCH YOUR SITUATION
$domainPath = 'http://yourdomain.com' //set this to the full path of your server, can be an IP address if no domain name
$basePath = '/kodi-shield'; //set this to the base path on your server
This script uses the Shields.io JSON endpoint to return the JSON needed to generate the badge. Read the information on the Shields.io website for more information on how this works. An example of using the badge within the markdown file of your project could be:
![Kodi Version](https://img.shields.io/endpoint?url=https%3A%2F%2Fdomain.com%2Fkodi-shield%2Frobweber%2Fxbmcbackup)
You can generate a URL of your own using the URL generator on the Shields.io website (scroll to the bottom of the page). The script takes the following URL parameters in the following order (some are optional):
/kodi-shield/:username/:repo/:branch/:shownames/:currentonly
- username required - your Github username
- repo required - the name of the repository for your addon
- branch - the branch name, master is assumed by default
- shownames - a true/false value on if the codenames for each Kodi version should also be shown
- currentonly - another true/false value. By default all compatible Kodi versions are shown, this shows only the most current supported version.
![Kodi Version](https://img.shields.io/endpoint?url=https%3A%2F%2Fdomain.com%2Fkodi-shield%2Frobweber%2Fxbmcbackup)
![Kodi Version](https://img.shields.io/endpoint?url=https%3A%2F%2Fdomain.com%2Fkodi-shield%2Frobweber%2Fxbmcbackup%2Fmaster%2Ftrue)
![Kodi Version](https://img.shields.io/endpoint?url=https%3A%2F%2Fdomain.com%2Fkodi-shield%2Frobweber%2Fxbmcbackup%2Fmaster%2Ftrue%2Ftrue)