Skip to content

Instantly share code, notes, and snippets.

@mcarlton00
Created April 28, 2019 03:38
Show Gist options
  • Save mcarlton00/a660d299002457603330f2054d3e2388 to your computer and use it in GitHub Desktop.
Save mcarlton00/a660d299002457603330f2054d3e2388 to your computer and use it in GitHub Desktop.
Creating Addon Repo for jellyfin-kodi
#!/usr/bin/env bash
# Handles creating a kodi repository for the Jellyfin addon.
# There's 2 main parts involved to a kodi repository:
# A zipped addon for easy installation and a web server
# used for distributing the actual addons in the repo.
# IMPORTANT NOTES:
# 1. The create_repository.py script requires gitpython to
# be installed. It checks for this before doing anything else.
# 2. The create_repository.py script needs to be ran after each
# update to the addon so an up to date build is always available
# in the repo. Possibly incorporate this as a githook?
# 3. I'll leave the choice whether to update the addon providers
# up to you. Above my pay grade, so to speak. Line 40
# The URL where the repo where be found online
REPO_URL="https://repo.jellyfin.org/releases/client/kodi"
# The path on the server where the repo files are stored
FILESYSTEM_PATH="/usr/local/www/releases/client/kodi"
# Check if gitpython is here
python -c 'import git'
if [ $? != 0 ]; then
echo "Please install gitpython to create the repo. Exiting"
exit
fi
# From instructions here: https://kodi.wiki/view/HOW-TO:Create_a_repository_for_add-ons
echo "Creating repo web files"
wget -qN https://raw.githubusercontent.com/chadparry/kodi-repository.chad.parry.org/master/tools/create_repository.py && chmod +x create_repository.py
./create_repository.py --datadir=$FILESYSTEM_PATH https://github.com/jellyfin/jellyfin-kodi
# Template of XML needed for installable zip file
IFS='' read -r -d '' addon_xml <<"EOF"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="repository.jellyfin.kodi" name="Kodi Jellyfin Addons" version="1.0.0" provider-name="null_pointer,angelblue05,sualfred,im85288,xnappo">
<requires>
<import addon="xbmc.addon" version="12.0.0"/>
</requires>
<extension point="xbmc.addon.repository" name="Kodi Jellyfin Repository">
<dir>
<info compressed="false">URL_HERE/addons.xml</info>
<checksum>URL_HERE/addons.xml.md5</checksum>
<datadir zip="true">URL_HERE</datadir>
</dir>
</extension>
<extension point="xbmc.addon.metadata">
<summary>Kodi Jellyfin Addon Repository</summary>
<description>This repo contains addons related to the Jellyfin project</description>
<disclaimer></disclaimer>
<platform>all</platform>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
</extension>
</addon>
EOF
# Populate true URL into xml template
addon_xml=`echo "${addon_xml//URL_HERE/$REPO_URL}"`
# Create file structure for zipped addon
mkdir -p repository.jellyfin.kodi/resources
# Write xml file
echo "Creating xml file"
printf "$addon_xml" > repository.jellyfin.kodi/addon.xml
echo "Getting jellyfin images"
wget --quiet https://raw.githubusercontent.com/jellyfin/jellyfin-kodi/master/fanart.png -O repository.jellyfin.kodi/resources/fanart.png
wget --quiet https://raw.githubusercontent.com/jellyfin/jellyfin-kodi/master/icon.png -O repository.jellyfin.kodi/resources/icon.png
echo "Creating zipped repo installer"
zip -qrm repository.jellyfin.kodi.zip repository.jellyfin.kodi
echo "\nComplete!"
echo "\nDistribute this file for easy repo installation:"
echo "`pwd`/repository.jellyfin.kodi.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment