<advancedsettings>
<services>
  <esallinterfaces>true</esallinterfaces>
  <webserver>true</webserver>
  <webserverport>true</webserverport>
  <webserverauthentication>true</webserverauthentication>
  <webserverusername>kodi</webserverusername>
  <webserverpassword>{{ kodi_webserver_password | default ('kodi', true) }}</webserverpassword>
  <zeroconf>true</zeroconf>
</services>
{% if kodi_mysql_server is defined and kodi_mysql_user is defined and kodi_mysql_pass is defined %}
{% if kodi_source_videos|length > 0 %}
  <videodatabase>
    <type>mysql</type>
    <host>{{ kodi_mysql_server }}</host>
    <port>3306</port>
    <user>{{ kodi_mysql_user }}</user>
    <pass>{{ kodi_mysql_pass }}</pass>
  </videodatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
{% endif %}
{% if kodi_source_music|length > 0 %}
  <musicdatabase>
    <type>mysql</type>
    <host>{{ kodi_mysql_server }}</host>
    <port>{{ kodi_mysql_port }}</port>
    <user>{{ kodi_mysql_user }}</user>
    <pass>{{ kodi_mysql_pass }}</pass>
  </musicdatabase>
{% endif %}
<pathsubstitution>
{% if kodi_playlists_path | length > 0 %}
  <substitute>
    <from>special://profile/playlists/</from>
    <to>{{ kodi_playlists_path }}</to>
  </substitute>
{% endif %}
{% if kodi_keymaps_path | length > 0 %}
  <substitute>
    <from>special://profile/keymaps/</from>
    <to>{{ kodi_keymaps_path }}</to>
  </substitute>
{% endif %}
{% if kodi_sources_path | length > 0 %}
  <substitute>
    <from>special://profile/sources.xml</from>
    <to>{{ kodi_sources_path }}</to>
  </substitute>
{% endif %}
{% if kodi_mediasources_path | length > 0 %}
  <substitute>
    <from>special://profile/mediasources.xml</from>
    <to>{{ kodi_mediasources_path }}</to>
  </substitute>
{% endif %}
{% if kodi_feeds_path | length > 0 %}
  <substitute>
    <from>special://profile/RssFeeds.xml</from>
    <to>{{ kodi_feeds_path }}</to>
  </substitute>
{% endif %}
{% if kodi_favourites_path | length > 0 %}
  <substitute>
    <from>special://profile/favourites.xml</from>
    <to>{{ kodi_favourites_path }}</to>
  </substitute>
{% endif %}
{% if kodi_passwords_path | length > 0 %}
  <substitute>
    <from>special://profile/passwords.xml</from>
    <to>{{ kodi_passwords_path }}</to>
  </substitute>
{% endif %}
</pathsubstitution>
{% endif %}
</advancedsettings>
