milaq / kodi-headless

A headless, dockerized Kodi instance for a shared MySQL database
48 stars 15 forks source link

Introduction

A headless, dockerized Kodi instance for a shared MySQL setup to allow having a webinterface and automatic periodic library updates without the need for a player system to be permanently on.

Tags

Tagname Branch Kodi version Base distro
latest leia 18 Debian Stretch
leia leia 18 Debian Stretch
krypton krypton 17 Debian Stretch

Attention: The Information found below may differ between branches/tags. Make sure you inspect the readme for the respective tag.

You are currently viewing the readme for the branch: leia

Prerequisites

You need to have set up library sharing via a dedicated MySQL database beforehand by reading, understanding and executing the necessary steps in the MySQL library sharing guide.

WARNING - as already stated in the wiki but here once again: Every client must run the same version of Kodi!

Best way to set up library sharing in the container is by fully configuring your shared library, its sources and scrapers via another GUI host (e.g. your HTPC) and setting up the Kodi headless instance afterwards. The server needs fully configured database access and your sources (SMB or NFS) must be reachable from the headless instance. All updating, scraping and cleaning can then be handled automatically by the headless Kodi instance on its own.

REMINDER: If you are not using the default scrapers you need to take care of installing and enabling the respective plugins in the container yourself.

Usage

Get the container image:

docker pull milaq/kodi-headless:leia

Run the container and set necessary environment variables:

docker run -d --restart=always --log-opt max-size=50M --name kodi-headless -e KODI_DBHOST=<MY_KODI_DBHOST> -e KODI_DBUSER=<MY_KODI_DBUSER> -e KODI_DBPASS=<MY_KODI_DBPASS> milaq/kodi-headless:leia

If you want to map the webinterface ports natively then also append:

-p 8080:8080 -p 9090:9090

If eventserver access is also required outside of the container:

-p 9777:9777

Container environment variables:

Deprecated:

Experimental: You may also mount your own copy of advancedsettings.xml if you like to. The container startup will then skip any of the database configuration variables (KODI_DB*) and just use the supplied copy.

Automatic library cleaning

If you want to enable automatic library cleaning you HAVE to create an appropriate sources.xml and passwords.xml (or grab a copies from your HTPC)

/config/userdata/sources.xml
/config/userdata/passwords.xml

inside the container volume directly or reference a copy on the docker host, e.g.:

-v /path/to/sources.xml:/config/userdata/sources.xml
-v /path/to/passwords.xml:/config/userdata/passwords.xml

and enable library cleaning via the respective flag, e.g.:

-e KODI_CLEAN_INTERVAL=86400

WARNING: A misconfigured sources.xml or passwords.xml can lead to the Kodi instance not finding any of your media which will result in emtpying your database. Make a backup of your database and/or be double sure before enabling this feature!

NOTE: If you don't utilize network shares which require authentication you may also supply a skeleton passwords.xml:

<passwords>
</passwords>

Credits

Thanks goes out to linuxserver.io for creating a solid base of a dockerized Kodi version to work with. More thanks goes to Celedhrim for creating the initial headless patch and sinopsysHK for the new headless patch since Leia.