<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE xs:schema PUBLIC
        "-//W3C//DTD XMLSCHEMA 200102//EN"
        "http://www.w3.org/2001/XMLSchema.dtd">  -->
<!--*GRB*

    Gerbera - https://gerbera.io/

    config2.xsd - this file is part of Gerbera.

    Copyright (C) 2016-2025 Gerbera Contributors

    Gerbera is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2
    as published by the Free Software Foundation.

    Gerbera is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Gerbera.  If not, see <http://www.gnu.org/licenses/>.


    $Id$
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://gerbera.io/config/2"
           xmlns="http://gerbera.io/config/2" elementFormDefault="qualified">

    <xs:simpleType name="boolean">
        <xs:restriction base="xs:string">
            <xs:enumeration value="true"/>
            <xs:enumeration value="false"/>
            <xs:enumeration value="yes"/>
            <xs:enumeration value="no"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="config">
        <xs:complexType>
            <xs:all>
                <xs:element ref="server"/>
                <xs:element ref="clients" minOccurs="0"/>
                <xs:element ref="import" minOccurs="0"/>
                <xs:element ref="transcoding" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="version" type="xs:positiveInteger" fixed="2"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="server">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ui" minOccurs="0"/>
                <xs:element ref="logging" minOccurs="0"/>
                <xs:element ref="port" minOccurs="0"/>
                <xs:element ref="name" minOccurs="0"/>

                <!-- required, but autogenerated by MediaTomb at startup -->
                <xs:element ref="udn" minOccurs="0"/>

                <xs:element ref="home"/>
                <xs:element ref="webroot"/>
                <xs:element ref="storage"/>
                <xs:element ref="ip" minOccurs="0"/>
                <xs:element ref="interface" minOccurs="0"/>
                <xs:element ref="modelURL" minOccurs="0"/>
                <xs:element ref="modelName" minOccurs="0"/>
                <xs:element ref="modelNumber" minOccurs="0"/>
                <xs:element ref="bookmark" minOccurs="0"/>
                <xs:element ref="model" minOccurs="0"/>
                <xs:element ref="manufacturer" minOccurs="0"/>
                <xs:element ref="manufacturerURL" minOccurs="0"/>
                <xs:element ref="virtualURL" minOccurs="0"/>
                <xs:element ref="externalURL" minOccurs="0"/>
                <xs:element ref="presentationURL" minOccurs="0"/>
                <xs:element ref="upnp-string-limit" minOccurs="0"/>
                <xs:element ref="alive" minOccurs="0"/>
                <xs:element ref="modelDescription" minOccurs="0"/>
                <xs:element ref="serialNumber" minOccurs="0"/>
                <xs:element ref="extended-runtime-options" minOccurs="0"/>
                <xs:element ref="pc-directory" minOccurs="0"/>
                <xs:element ref="tmpdir" minOccurs="0"/>
                <xs:element ref="retries-on-timeout" minOccurs="0"/>
                <xs:element ref="upnp" minOccurs="0"/>
                <xs:element ref="containers" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="debug-mode" type="xs:string"/>
            <xs:attribute name="upnp-max-jobs" type="xs:nonNegativeInteger"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="port" type="xs:nonNegativeInteger"/>

    <xs:element name="ip" type="xs:string"/>

    <xs:element name="interface" type="xs:string"/>

    <xs:element name="name" type="xs:string" default="MediaTomb"/>

    <xs:element name="modelName" type="xs:string" default="MediaTomb"/>

    <xs:element name="modelNumber" type="xs:string"/>

    <xs:element name="modelURL" type="xs:string"/>

    <xs:element name="modelDescription" type="xs:string"/>

    <xs:element name="manufacturer" type="xs:string"/>

    <xs:element name="manufacturerURL" type="xs:string" default="http://gerbera.io/"/>

    <xs:element name="virtualURL" type="xs:string"/>
    <xs:element name="externalURL" type="xs:string"/>
    <xs:element name="presentationURL" default="/">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="append-to" default="none">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="none"/>
                                <xs:enumeration value="ip"/>
                                <xs:enumeration value="port"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="udn" type="xs:string"/>

    <xs:element name="home" default="~">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="override" type="boolean" default="no"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="webroot" type="xs:string"/>

    <xs:element name="alive" type="xs:positiveInteger" default="180"/>

    <xs:element name="serialNumber" type="xs:string"/>

    <xs:element name="extended-runtime-options">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ffmpegthumbnailer" minOccurs="0"/>
                <xs:element ref="mark-played-items" minOccurs="0"/>
                <xs:element ref="lastfm" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="ffmpegthumbnailer">
        <xs:complexType>
            <xs:all>
                <xs:element ref="cache-dir" minOccurs="0"/>
                <xs:element ref="thumbnail-size" minOccurs="1"/>
                <xs:element ref="seek-percentage" minOccurs="1"/>
                <xs:element ref="filmstrip-overlay" minOccurs="0"/>
                <xs:element ref="rotate" minOccurs="0"/>
                <xs:element ref="workaround-bugs" minOccurs="0"/>
                <xs:element ref="image-quality" minOccurs="1"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="no"/>
            <xs:attribute name="video-enabled" type="boolean" default="yes"/>
            <xs:attribute name="image-enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="filmstrip-overlay" type="boolean" default="no"/>
    <xs:element name="rotate" type="boolean" default="no"/>
    <xs:element name="cache-dir">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="enabled" type="boolean" default="yes"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>
    <xs:element name="thumbnail-size" type="xs:positiveInteger" default="128"/>
    <xs:element name="seek-percentage" type="xs:positiveInteger" default="5"/>
    <xs:element name="workaround-bugs" type="boolean" default="no"/>
    <xs:element name="image-quality" type="xs:positiveInteger" default="8"/>

    <xs:element name="mark-played-items">
        <xs:complexType>
            <xs:all>
                <xs:element ref="string" minOccurs="0"/>
                <xs:element ref="mark" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="no"/>
            <xs:attribute name="suppress-cds-updates" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="string">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="mode" default="prepend">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="append"/>
                                <xs:enumeration value="prepend"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="mark">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="content" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="content">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="audio"/>
                <xs:enumeration value="image"/>
                <xs:enumeration value="video"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="lastfm">
        <xs:complexType>
            <xs:all>
                <xs:element name="username" type="xs:string" minOccurs="0"/>
                <xs:element name="password" type="xs:string" minOccurs="0"/>
                <xs:element name="sessionkey" type="xs:string" minOccurs="0"/>
                <xs:element name="auth-url" type="xs:string" minOccurs="0"/>
                <xs:element name="scrobble-url" type="xs:string" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add">
        <xs:complexType>
            <xs:attribute name="header" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="upnp-string-limit" type="xs:integer"/>

    <xs:element name="bookmark" type="xs:string"/>

    <xs:element name="model" type="xs:string"/>

    <xs:element name="pc-directory">
        <xs:complexType>
            <xs:attribute name="upnp-hide" type="boolean" use="required"/>
            <xs:attribute name="web-hide" type="boolean" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="tmpdir" type="xs:string"/>

    <xs:element name="retries-on-timeout" type="xs:integer"/>

    <xs:element name="ui">
        <xs:complexType>
            <xs:all>
                <xs:element ref="accounts" minOccurs="0"/>
                <xs:element ref="items-per-page" minOccurs="0"/>
                <xs:element name="source-docs-link" minOccurs="0" type="xs:string"/>
                <xs:element name="user-docs-link" minOccurs="0" type="xs:string"/>
                <xs:element name="content-security-policy" minOccurs="0" type="xs:string"/>
                <xs:element ref="extension-mimetype" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="poll-interval" type="xs:positiveInteger" default="2"/>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="poll-when-idle" type="boolean" default="no"/>
            <xs:attribute name="show-tooltips" type="boolean" default="yes"/>
            <xs:attribute name="show-numbering" type="boolean" default="yes"/>
            <xs:attribute name="show-thumbnail" type="boolean" default="yes"/>
            <xs:attribute name="show-video" type="boolean" default="no"/>
            <xs:attribute name="fs-add-item" type="boolean" default="no"/>
            <xs:attribute name="edit-sortkey" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="logging">
        <xs:complexType>
            <xs:attribute name="rotate-file-size" type="xs:positiveInteger" default="5242880"/>
            <xs:attribute name="rotate-file-count" type="xs:positiveInteger" default="10"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="accounts">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="account" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="session-timeout" type="xs:positiveInteger" default="30"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="account">
        <xs:complexType>
            <xs:attribute name="user" type="xs:string" use="required"/>
            <xs:attribute name="password" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="items-per-page">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="default" type="xs:positiveInteger" default="25"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="option" type="xs:positiveInteger"/>

    <xs:element name="containers">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="container" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="container">
        <xs:complexType>
            <xs:all>
                <xs:element ref="filter" minOccurs="1" maxOccurs="1"/>
            </xs:all>
            <xs:attribute name="location" type="xs:string" use="required"/>
            <xs:attribute name="title" type="xs:string"/>
            <xs:attribute name="image" type="xs:string"/>
            <xs:attribute name="sort" type="xs:string"/>
            <xs:attribute name="upnp-shortcut" type="xs:string"/>
            <xs:attribute name="max-count" type="xs:positiveInteger" default="500"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="filter" type="xs:string"/>

    <!-- Storage -->

    <xs:element name="storage">
        <xs:complexType>
            <xs:all>
                <xs:element ref="sqlite3" minOccurs="0"/>
                <xs:element ref="mysql" minOccurs="0"/>
                <xs:element ref="postgres" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="use-transactions" type="boolean" default="no"/>
            <xs:attribute name="enable-sort-key" type="boolean" default="yes"/>
            <xs:attribute name="string-limit" type="xs:nonNegativeInteger" default="255"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="sqlite3">
        <xs:complexType>
            <xs:all>
                <xs:element ref="database-file" minOccurs="0"/>
                <xs:element ref="init-sql-file" minOccurs="0"/>
                <xs:element ref="upgrade-file" minOccurs="0"/>
                <xs:element ref="drop-file" minOccurs="0"/>
                <xs:element ref="synchronous" minOccurs="0"/>
                <xs:element ref="journal-mode" minOccurs="0"/>
                <xs:element ref="on-error" minOccurs="0"/>
                <xs:element ref="backup" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="shutdown-attempts" type="xs:positiveInteger" default="5"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="database-file" type="xs:string" default="mediatomb.db"/>

    <xs:element name="synchronous" default="off">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="off"/>
                <xs:enumeration value="normal"/>
                <xs:enumeration value="full"/>
                <xs:enumeration value="extra"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="journal-mode" default="WAL">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="OFF"/>
                <xs:enumeration value="DELETE"/>
                <xs:enumeration value="TRUNCATE"/>
                <xs:enumeration value="PERSIST"/>
                <xs:enumeration value="MEMORY"/>
                <xs:enumeration value="WAL"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="on-error" default="restore">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="restore"/>
                <xs:enumeration value="fail"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="backup">
        <xs:complexType>
            <xs:attribute name="enabled" type="boolean" default="no"/>
            <xs:attribute name="interval" type="xs:string" default="600"/>
            <!-- <xs:attribute name="interval" type="xs:time" default="10:00"/> -->
        </xs:complexType>
    </xs:element>

    <xs:element name="mysql">
        <xs:complexType>
            <xs:all>
                <xs:element ref="host" minOccurs="0"/>
                <xs:element ref="port" minOccurs="0"/>
                <xs:element ref="username" minOccurs="0"/>
                <xs:element ref="password" minOccurs="0"/>
                <xs:element ref="database" minOccurs="0"/>
                <xs:element ref="socket" minOccurs="0"/>
                <xs:element ref="init-sql-file" minOccurs="0"/>
                <xs:element ref="upgrade-file" minOccurs="0"/>
                <xs:element ref="drop-file" minOccurs="0"/>
                <xs:element ref="engine" minOccurs="0"/>
                <xs:element ref="charset" minOccurs="0"/>
                <xs:element ref="collation" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="postgres">
        <xs:complexType>
            <xs:all>
                <xs:element ref="host" minOccurs="0"/>
                <xs:element ref="port" minOccurs="0"/>
                <xs:element ref="username" minOccurs="0"/>
                <xs:element ref="password" minOccurs="0"/>
                <xs:element ref="database" minOccurs="0"/>
                <xs:element ref="socket" minOccurs="0"/>
                <xs:element ref="init-sql-file" minOccurs="0"/>
                <xs:element ref="upgrade-file" minOccurs="0"/>
                <xs:element ref="drop-file" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>


    <xs:element name="host" type="xs:string" default="localhost"/>
    <xs:element name="username" type="xs:string" default="gerbera"/>
    <xs:element name="password" type="xs:string"/>
    <xs:element name="database" type="xs:string" default="gerbera"/>
    <xs:element name="init-sql-file" type="xs:string"/>
    <xs:element name="socket" type="xs:string"/>
    <xs:element name="upgrade-file" type="xs:string"/>
    <xs:element name="drop-file" type="xs:string"/>
    <xs:element name="engine" type="xs:string" default="MyISAM"/>
    <xs:element name="charset" type="xs:string" default="utf8"/>
    <xs:element name="collation" type="xs:string" default="utf8_general_ci"/>

    <xs:element name="upnp">
        <xs:complexType>
            <xs:all>
                <xs:element ref="search-item-result" minOccurs="0"/>
                <xs:element name="album-properties" type="upnp-properties" minOccurs="0"/>
                <xs:element name="artist-properties" type="upnp-properties" minOccurs="0"/>
                <xs:element name="genre-properties" type="upnp-properties" minOccurs="0"/>
                <xs:element name="playlist-properties" type="upnp-properties" minOccurs="0"/>
                <xs:element name="title-properties" type="upnp-properties" minOccurs="0"/>
                <xs:element name="resource-defaults" type="upnp-defaults" minOccurs="0"/>
                <xs:element name="object-defaults" type="upnp-defaults" minOccurs="0"/>
                <xs:element name="container-defaults" type="upnp-defaults" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="multi-value" type="boolean" default="yes"/>
            <xs:attribute name="dynamic-descriptions" type="boolean" default="yes"/>
            <xs:attribute name="literal-host-redirection" type="boolean" default="no"/>
            <xs:attribute name="searchable-container-flag" type="boolean" default="no"/>
            <xs:attribute name="search-result-separator" type="xs:string" default=" - "/>
            <xs:attribute name="search-filename" type="boolean" default="no"/>
            <xs:attribute name="caption-info-count" type="xs:integer" default="-1"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="search-item-result">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-data" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="upnp-properties">
        <xs:sequence>
            <xs:element ref="upnp-namespace" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="upnp-property" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="extend" type="boolean" default="no"/>
    </xs:complexType>

    <xs:complexType name="upnp-defaults">
        <xs:sequence>
            <xs:element ref="property-default" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="extend" type="boolean" default="no"/>
    </xs:complexType>

    <xs:element name="upnp-property">
        <xs:complexType>
            <xs:attribute name="upnp-tag" type="xs:string" use="required"/>
            <xs:attribute name="meta-data" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="upnp-namespace">
        <xs:complexType>
            <xs:attribute name="FIXMExmlns" type="xs:string" use="required"/>
            <xs:attribute name="uri" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="property-default">
        <xs:complexType>
            <xs:attribute name="tag" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Clients -->

    <xs:element name="clients">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded">
                <xs:element ref="client"/>
                <xs:element ref="group"/>
            </xs:choice>
            <xs:attribute name="enabled" type="boolean" default="no"/>
            <xs:attribute name="cache-threshold" type="xs:positiveInteger" default="6"/>
            <xs:attribute name="bookmark-offset" type="xs:positiveInteger" default="10"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="client">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="header" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="dlna" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="ip" type="xs:string"/>
            <xs:attribute name="userAgent" type="xs:string"/>
            <xs:attribute name="friendlyName" type="xs:string"/>
            <xs:attribute name="modelName" type="xs:string"/>
            <xs:attribute name="manufacturer" type="xs:string"/>
            <xs:attribute name="group" type="xs:string"/>
            <xs:attribute name="flags" type="xs:string"/>
            <xs:attribute name="caption-info-count" type="xs:integer" default="-1"/>
            <xs:attribute name="upnp-string-limit" default="-1"/>
            <xs:attribute name="multi-value" type="boolean" default="yes"/>
            <xs:attribute name="full-filter" type="boolean" default="no"/>
            <xs:attribute name="allowed" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="header">
        <xs:complexType>
            <xs:attribute name="key" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="dlna">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="group">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="hide" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="allowed" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="hide">
        <xs:complexType>
            <xs:attribute name="location" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Import -->

    <xs:element name="import">
        <xs:complexType>
            <xs:all>
                <xs:element ref="scripting" minOccurs="0"/>
                <xs:element ref="mappings" minOccurs="0"/>
                <xs:element ref="filesystem-charset" minOccurs="0"/>
                <xs:element ref="metadata-charset" minOccurs="0"/>
                <xs:element ref="playlist-charset" minOccurs="0"/>
                <xs:element ref="autoscan" minOccurs="0"/>
                <xs:element ref="system-directories" minOccurs="0"/>
                <xs:element ref="visible-directories" minOccurs="0"/>
                <xs:element ref="virtual-directories" minOccurs="0"/>
                <xs:element ref="directories" minOccurs="0"/>
                <xs:element ref="layout" minOccurs="0"/>
                <xs:element ref="resources" minOccurs="0"/>
                <xs:element ref="library-options" minOccurs="0"/>
                <xs:element ref="magic-file" minOccurs="0"/>
                <xs:element ref="online-content" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="hidden-files" type="boolean" default="no"/>
            <xs:attribute name="follow-symlinks" type="boolean" default="yes"/>
            <xs:attribute name="default-date" type="boolean" default="yes"/>
            <xs:attribute name="nomedia-file" type="xs:string" default=".nomedia"/>
            <xs:attribute name="readable-names" type="boolean" default="yes"/>
            <xs:attribute name="case-sensitive-tags" type="boolean" default="yes"/>
            <xs:attribute name="import-mode" default="mt">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="grb"/>
                        <xs:enumeration value="mt"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="scripting">
        <xs:complexType>
            <xs:all>
                <xs:element ref="script-folder" minOccurs="0"/>
                <xs:element ref="import-function" minOccurs="0"/>
                <xs:element ref="virtual-layout" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="script-charset" type="xs:string" default="UTF-8"/>
            <xs:attribute name="scan-interval" type="xs:string" default="48:00"/>
            <xs:attribute name="scan-mode">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="timed"/>
                        <xs:enumeration value="inotify"/>
                        <xs:enumeration value="manual"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="script-folder">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="common" minOccurs="0"/>
                <xs:element ref="custom" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="common" type="xs:string"/>
    <xs:element name="custom" type="xs:string"/>
    <xs:element name="common-folder" type="xs:string"/>
    <xs:element name="custom-folder" type="xs:string"/>

    <xs:element name="import-function">
        <xs:complexType>
            <xs:all>
                <xs:element ref="audio-file" minOccurs="0"/>
                <xs:element ref="video-file" minOccurs="0"/>
                <xs:element ref="image-file" minOccurs="0"/>
                <xs:element ref="playlist" minOccurs="0"/>
                <xs:element ref="meta-file" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="audio-file" type="xs:string"/>
    <xs:element name="video-file" type="xs:string"/>
    <xs:element name="image-file" type="xs:string"/>
    <xs:element name="meta-file" type="xs:string"/>
    <xs:element name="playlist">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="create-link" type="boolean" default="yes"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="virtual-layout">
        <xs:complexType>
            <xs:all>
                <xs:element ref="import-script" minOccurs="0"/>
                <xs:element ref="script-options" minOccurs="0"/>
                <xs:element ref="genre-map" minOccurs="0"/>
                <xs:element ref="boxlayout" minOccurs="0"/>
                <xs:element ref="structured-layout" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="type" default="builtin">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="builtin"/>
                        <xs:enumeration value="js"/>
                        <xs:enumeration value="disabled"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="audio-layout" type="xs:string"/>
            <xs:attribute name="video-layout" type="xs:string"/>
            <xs:attribute name="image-layout" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="import-script" type="xs:string"/>

    <xs:element name="system-directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="visible-directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-path">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="virtual-directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="key" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="key">
        <xs:complexType>
            <xs:attribute name="metadata" type="xs:string" use="required"/>
            <xs:attribute name="class" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="script-options">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="script-option" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="script-option">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="genre-map">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="genre" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="genre">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="boxlayout">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded">
                <xs:element ref="box"/>
                <xs:element ref="chain"/>
            </xs:choice>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="chain">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="link" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="type" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="link">
        <xs:complexType>
            <xs:attribute name="key" type="xs:string"/>
            <xs:attribute name="title" type="xs:string"/>
            <xs:attribute name="class" type="xs:string"/>
            <xs:attribute name="sortKey" type="xs:string"/>
            <xs:attribute name="upnpShortcut" type="xs:string"/>
            <xs:attribute name="res" type="xs:string"/>
            <xs:attribute name="aux" type="xs:string"/>
            <xs:attribute name="metaData" type="xs:string"/>
            <xs:attribute name="refID" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="box">
        <xs:complexType>
            <xs:attribute name="key" type="xs:string"/>
            <xs:attribute name="title" type="xs:string"/>
            <xs:attribute name="class" type="xs:string"/>
            <xs:attribute name="upnp-shortcut" type="xs:string"/>
            <xs:attribute name="sort-key" type="xs:string"/>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="searchable" type="boolean" default="yes"/>
            <xs:attribute name="size" type="xs:integer" default="1"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="structured-layout">
        <xs:complexType>
            <xs:attribute name="skip-chars" type="xs:string"/>
            <xs:attribute name="div-char" type="xs:string" default="-"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="filesystem-charset" type="xs:string"/>

    <xs:element name="metadata-charset" type="xs:string"/>

    <xs:element name="playlist-charset" type="xs:string"/>

    <xs:element name="magic-file" type="xs:string"/>

    <xs:element name="autoscan">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="directory" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="use-inotify">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="auto"/>
                        <xs:enumeration value="yes"/>
                        <xs:enumeration value="no"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="inotify-attrib" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="directory">
        <xs:complexType>
            <xs:all>
                <xs:element name="container-type-audio" minOccurs="0" type="xs:string"/>
                <xs:element name="container-type-video" minOccurs="0" type="xs:string"/>
                <xs:element name="container-type-image" minOccurs="0" type="xs:string"/>
            </xs:all>
            <xs:attribute name="location" type="xs:string" use="required"/>

            <!-- required only for "timed" mode -->
            <xs:attribute name="interval" type="xs:string"/>

            <xs:attribute name="hidden-files" type="boolean"/>
            <xs:attribute name="follow-symlinks" type="boolean"/>
            <xs:attribute name="recursive" type="boolean" use="required"/>
            <xs:attribute name="dirtypes" type="boolean" default="yes"/>
            <xs:attribute name="media-type" type="xs:string"/>
            <xs:attribute name="retry-count" type="xs:nonNegativeInteger"/>
            <xs:attribute name="force-reread-unknown" type="boolean" default="no"/>
            <xs:attribute name="container-type-audio" type="xs:string"/>
            <xs:attribute name="container-type-image" type="xs:string"/>
            <xs:attribute name="container-type-video" type="xs:string"/>
            <xs:attribute name="mode" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="timed"/>
                        <xs:enumeration value="inotify"/>
                        <xs:enumeration value="manual"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="tweak" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="tweak">
        <xs:complexType>
            <xs:attribute name="location" type="xs:string" use="required"/>

            <xs:attribute name="inherit" type="boolean" use="required"/>
            <xs:attribute name="hidden-files" type="boolean"/>
            <xs:attribute name="recursive" type="boolean"/>
            <xs:attribute name="case-sensitive" type="boolean"/>
            <xs:attribute name="fanart-file" type="xs:string"/>
            <xs:attribute name="subtitle-file" type="xs:string"/>
            <xs:attribute name="resource-file" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="layout">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
            <xs:attribute name="parent-path" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="path">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mappings">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ignore-extensions" minOccurs="0"/>
                <xs:element ref="extension-mimetype" minOccurs="0"/>
                <xs:element ref="mimetype-contenttype" minOccurs="0"/>
                <xs:element ref="mimetype-upnpclass" minOccurs="0"/>
                <xs:element ref="mimetype-dlnatransfermode" minOccurs="0"/>
                <xs:element ref="contenttype-dlnaprofile" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="ignore-extensions">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="extension-mimetype">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
            <xs:attribute name="default" type="xs:string"/>
            <xs:attribute name="ignore-unknown" type="boolean" default="no"/>
            <xs:attribute name="case-sensitive" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-contenttype">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="treat" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
            <xs:attribute name="ignore-unknown" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="treat">
        <xs:complexType>
            <xs:attribute name="mimetype" type="xs:string" use="required"/>
            <xs:attribute name="as" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-upnpclass">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-dlnatransfermode">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="map">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
            <xs:attribute name="audioCodec" type="xs:string"/>
            <xs:attribute name="videoCodec" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="contenttype-dlnaprofile">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="resources">
        <xs:complexType>
            <xs:all>
                <xs:element ref="order" minOccurs="0"/>
                <xs:element name="container" type="resContainer" minOccurs="0"/>
                <xs:element ref="fanart" minOccurs="0"/>
                <xs:element ref="subtitle" minOccurs="0"/>
                <xs:element ref="metafile" minOccurs="0"/>
                <xs:element ref="resource" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="case-sensitive" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="order">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="handler" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="resContainer">
        <xs:sequence>
            <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="add-dir" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="extend" type="boolean" default="no"/>
        <xs:attribute name="location" type="xs:string"/>
        <xs:attribute name="parentCount" type="xs:integer" default="2"/>
        <xs:attribute name="minDepth" type="xs:integer" default="2"/>
    </xs:complexType>

    <xs:element name="fanart">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="add-dir" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="subtitle">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="add-dir" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="metafile">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="add-dir" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="resource">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="add-dir" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="handler">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-file">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-dir">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="ext" type="xs:string"/>
            <xs:attribute name="pattern" type="xs:string"/>
            <xs:attribute name="mime" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="library-options">
        <xs:complexType>
            <xs:all>
                <xs:element ref="libexif" minOccurs="0"/>
                <xs:element ref="exiv2" minOccurs="0"/>
                <xs:element ref="ffmpeg" minOccurs="0"/>
                <xs:element ref="id3" minOccurs="0"/>
                <xs:element ref="mkv" minOccurs="0"/>
                <xs:element ref="wavpack" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="multi-value-separator" type="xs:string" default="; "/>
            <xs:attribute name="legacy-value-separator" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="libexif">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="exiv2">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="ffmpeg">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="artwork-enabled" type="boolean" default="no"/>
            <xs:attribute name="subtitle-seek-size" type="xs:nonNegativeInteger" default="2048"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="id3">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mkv">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="wavpack">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
                <xs:element ref="metadata" minOccurs="0"/>
                <xs:element ref="comment" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="charset" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="auxdata">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-data" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="metadata">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-data" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="extend" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-data">
        <xs:complexType>
            <xs:attribute name="tag" type="xs:string" use="required"/>
            <xs:attribute name="key" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="comment">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-comment" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-comment">
        <xs:complexType>
            <xs:attribute name="label" type="xs:string" use="required"/>
            <xs:attribute name="tag" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Transcoding -->

    <xs:element name="transcoding">
        <xs:complexType>
            <xs:all>
                <xs:element ref="mimetype-profile-mappings" minOccurs="0"/>
                <xs:element ref="profiles" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="fetch-buffer-size" type="xs:positiveInteger" default="262144"/>
            <xs:attribute name="fetch-buffer-fill-size" type="xs:nonNegativeInteger" default="0"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-profile-mappings">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="transcode" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="allow-unused" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="transcode">
        <xs:complexType>
            <xs:attribute name="mimetype" type="xs:string" use="required"/>
            <xs:attribute name="source-profile" type="xs:string"/>
            <xs:attribute name="client-flags" type="xs:string"/>
            <xs:attribute name="no-transcoding" type="xs:string"/>
            <xs:attribute name="using" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="profiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="profile" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="allow-unused" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="profile">
        <xs:complexType>
            <xs:all>
                <xs:element ref="mimetype"/>
                <xs:element ref="dlna-profile" minOccurs="0"/>
                <xs:element ref="accept-url" minOccurs="0"/>
                <xs:element ref="first-resource" minOccurs="0"/>
                <xs:element ref="hide-original-resource" minOccurs="0"/>
                <xs:element ref="accept-ogg-theora" minOccurs="0"/>
                <xs:element ref="agent"/>
                <xs:element ref="buffer"/>
                <xs:element ref="sample-frequency" minOccurs="0"/>
                <xs:element ref="audio-channels" minOccurs="0"/>
                <xs:element ref="resolution" minOccurs="0"/>
                <xs:element ref="thumbnail" minOccurs="0"/>
                <xs:element ref="avi-fourcc-list" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="dlna-profile" type="xs:string"/>
            <xs:attribute name="no-transcoding" type="xs:string"/>
            <xs:attribute name="client-flags" type="xs:string"/>
            <xs:attribute name="enabled" type="boolean" use="required"/>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="external"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="dlna-profile" type="xs:string"/>
    <xs:element name="mimetype">
        <xs:complexType mixed="true">
            <xs:sequence>
                <xs:element ref="mime-property" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="value" type="xs:string"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="mime-property">
        <xs:complexType>
            <xs:attribute name="key" type="xs:string" use="required"/>
            <xs:attribute name="resource" type="xs:string"/>
            <xs:attribute name="metadata" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="accept-url" type="boolean" default="yes"/>
    <xs:element name="first-resource" type="boolean" default="no"/>
    <xs:element name="hide-original-resource" type="boolean" default="no"/>
    <xs:element name="accept-ogg-theora" type="boolean" default="no"/>

    <xs:element name="agent">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="environ" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="command" type="xs:string" use="required"/>
            <xs:attribute name="arguments" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="buffer">
        <xs:complexType>
            <xs:attribute name="size" type="xs:positiveInteger" use="required"/>
            <xs:attribute name="chunk-size" type="xs:positiveInteger" use="required"/>
            <xs:attribute name="fill-size" type="xs:nonNegativeInteger" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="sample-frequency" type="xs:string"/>
    <xs:element name="audio-channels" type="xs:string"/>

    <xs:element name="resolution" type="xs:string"/>
    <xs:element name="thumbnail" type="boolean"/>
    <xs:element name="avi-fourcc-list">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="fourcc" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="mode" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="environ">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- online-content -->

    <xs:element name="online-content">
        <xs:complexType>
            <xs:attribute name="fetch-buffer-size" type="xs:positiveInteger" default="1048576"/>
            <xs:attribute name="fetch-buffer-fill-size" type="xs:nonNegativeInteger" default="0"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
