Centralize Kodi Management (Part 1)

Centralize Kodi Management (Part 1)

I have a few Fire TV Sticks (aka Firesticks), each serving a different TV in the house. They all consume content from a home-networked file server. It would be nice if these devices can be managed centrally.

I tried Plex for a while, but came back to Kodi because I didn't like how Plex organized my media.

I tried various ways to move the Kodi databases and configurations into my central file server. While I didn't achieve fully centralizing Kodi management, I was able to migrate enough configuration to a NAS to make it worthwhile. Here is my experience.

Accessing Firestick File System

To configure Kodi on Firestick properly, we need to access the Firestick file system. I simply installed ES File Explorer from the appstore. ES File Explorer comes with an FTP server, which can be turned on via Network > View on PC. This allows me to transfer files between my PC and Firestick.

Centralize Database

The first step of centralization is to centralize Kodi database.

Kodi is configured by default to use local SQLite database, so each Firestick use its own database. These databases are obviously not backed up, so if a Firestick is corrupted, I would lose the database on that device, and have to figure out a way to re-provision another Firestick to replace it. Ideally, I want all my Firesticks to share the same database anyway.

Instead, I pointed my Firesticks to a centralized MySQL (actually MariaDB) database hosted on my file server, so all of them share the same data. I can watch a movie on one Firestick, pause it, and continue on from a different Firestick. Also, the database is backed up along with my other files.

Here are the steps to achieve that:

  1. Create a MySQL or MariaDB database
  2. Enable remote access to the database
  3. Create a database user called kodi, with an appropriate password
  4. Create an advancedsettings.xml file, configure it to point to the centralized database. Upload this file to your Firestick. This file should be uploaded to this directory on Firestick: /Android/data/org.xbmc.kodi/files/.kodi/userdata
  5. Exit and restart Kodi, and it should be using your centralized database now

Here is a sample advancedsettings.xml file:

<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>xxx.xxx.xxx.xxx</host>
    <port>xxxx</port>
    <user>kodi</user>
    <pass>xxxxxxxx</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>xxx.xxx.xxx.xxx</host>
    <port>xxxx</port>
    <user>kodi</user>
    <pass>xxxxxxxx</pass>
  </musicdatabase>
</advancedsettings>