Centralize Kodi Management (Part 2)

Centralize Kodi Management (Part 2)

In Part 1 we moved our Kodi database to the central file server. Now we want to move user files to the central file server as well.

There are generally three types of user files in Kodi:

  1. configuration files such as passwords.xml or sources.xml
  2. other user saved data such as playlists or favourites.xml
  3. other data such as thumbnails and addons

Path Substitution

Kodi has a feature called Path Substitution which allows remapping Kodi files to different locations. This is the key to allow us to move some of the Kodi user files from Firestick to our file server.

Path Substitution is configurable in advancedsettings.xml.

Centralize Thumbnails

I started out by centralizing my Kodi thumbnails, because they take up an enormous amount of storage space, which Firestick is quite short of.

There are two components of Kodi thumbnails:

  • Thumbnails folder holds all the thumbnail image files
  • Database/Textures13.db file is the managing database for these thumbnails.

Kodi does not support sharing of thumbnails between devices. In fact the Path Substitution page has this to say about it:

Sharing the Thumbnails folder with Path Substitution is prone to problems, primarily because the Texture Cache consists of two interlinked data stores - the Thumbnails folder and the SQLite database Textures13.db. Sharing the SQLite Textures13.db between multiple clients is not supported under any circumstances due to the liklehood of database corruption.
Since sharing of the database is not realistically possible, attempts at sharing only the Thumbnails folder will either fail completely, or result in some artwork items never being displayed, or you may experience artwork being displayed but with higher or lower than expected image quality or even image corruption (a result of different clients overwriting previously cached artwork, as not all clients cache artwork at the same resolutions, or even use the same image formats).

I gave it a try and it looks like Kodi refuses to remap Textures13.db to my file server, so I am stuck with each Firestick having its own copy of the Textures13.db file. I can remap Thumbnails folders. The correct way is not to mix Thumbnails folders between devices. So on my file server I would need one Thumbnails folder dedicated to each Firestick device.

But, what's the worst that can happen? If thumbnails get corrupted, I can simply delete Textures13.db and Thumbnails folder and start over. So I remapped my Firesticks so they all share the same Thumbnails folder. Theoretically speaking since all my Firesticks are configured similarly, this should work fine.

Here is the relevant advancedsettings.xml section for thumbnails folder remapping:

  <pathsubstitution>
    <substitute>
      <from>special://userdata/Thumbnails/</from>
      <to>smb://myfs/kodi/subs/Thumbnails/</to>
    </substitute>
  </pathsubstitution>

Centralize Other Files

Right off the bat there are two files that cannot be centralized, because they are essential for our Kodi operations. These are:

  • advancedsettings.xml - this cannot be centralized because this file handles the centralization itself
  • passwords.xml - this cannot be centralized because Kodi needs this file to be able to access the file server

But as I experimented with centralizing other files, I ran into many issues. I ended up only centralizing a few key files:

  • keymaps folder - I centralized this folder so all my Firesticks can be configured with the same control scheme
  • favourites.xml - I centralized this file so favourites can be shared between devices
  • sources.xml - I centralized this file so I can edit it easily without FTP. All my devices can also share the same configurations
  • mediasources.xml - similar reason as to sources.xml

Actually the above files cover most of the essential files for me. As mentioned before advanedsettings.xml cannot be centralize. As to passwords.xml, I simplified it so it has only one entry and does not need to be changed at all. I wish I can centralize addon_data folder, but I will live without it for now.

My Kodi is working fine right now, and I am fine with its current setup. I will probably try to centralize my playlists folder in the near future.