2 Configure Import

The import settings define various options on how to aggregate the content.

Overall structure of import section (collapsible)
<import>
  <filesystem-charset/>
  <metadata-charset/>
  <scripting>
    <script-folder>
      <common/>
      <custom/>
    </script-folder>
    <import-function/>
    <virtual-layout>
      <import-script/>
      <script-options>
        <script-option/>
      </script-options>
      <genre-map>
        </genre>
      </genre-map>
      <strctured-layout/>
      <boxlayout>
        <box/>
        <chain>
          <link/>
        </chain>
      </boxlayout>
    </virtual-layout>
  </scripting>
  <magic-file/>
  <autoscan>
    <directory/>
  </autoscan>
  <system-directories>
    <add-path/>
  </system-directories>
  <visible-directories>
    <add-path/>
  </visible-directories>
  <layout>
    <path/>
  </layout>
  <resources>
    <order/>
    <fanart/>
    <subtitle/>
    <metafile/>
    <resource/>
    <container/>
  </resources>
  <mappings>
    <ignore-extensions/>
    <extension-mimetype/>
    <mimetype-contenttype/>
    <mimetype-upnpclass/>
    <mimetype-dlnatransfermode/>
    <contenttype-dlnaprofile/>
  </mappings>
  <virtual-directories>
    <key/>
  </virtual-directories>
  <library-options>
    <libexif>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </libexif>
    <id3>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </id3>
    <ffmpeg>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </ffmpeg>
    <exiv2>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </exiv2>
    <mkv>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </mkv>
    <wavpack/>
      <auxdata>
        <add-data/>
      </auxdata>
      <libcontent>
        <add-libcontent/>
      </libcontent>
      <metadata>
        <add-data/>
      </metadata>
    </wavpack>
  </library-options>
  <online-content>
    ... see respective page
  </online-content>
</import>

2.1 Import

Note

Whenever config entries in this section are changed, it is recommended to clear the database and restart a full import again. Otherwise the virtual layout can be broken or in some mixed state.

import
Type: Section
Required: True
<import hidden-files="no" follow-symlinks="no">

This tag defines the import section.

2.1.1 Import Attributes

import hidden-files
Type: Boolean
Required: False
Default: no
hidden-files="yes"

This attribute defines if files starting with a dot will be imported into the database (yes). Autoscan can override this attribute on a per directory basis. Hidden directories can also be marked with the nomedia-file.

Type: Boolean
Required: False
Default: yes
follow-symlinks="no"

This attribute defines if symbolic links should be treated as regular items and imported into the database (yes). This can cause duplicate entries if the link target is also scanned.

default-date
Type: Boolean
Required: False
Default: yes
default-date="no"

This attribute defines that each imported item will get a default media date set based on the modification time in order to ensure that sorting by “dc:date” works on upnp requests.

nomedia-file
Type: String
Required: False
Default: .nomedia
nomedia-file=".skip"

This attribute defines that a directory containing a file with this name is not imported into gerbera database. Only supported in “grb” import mode.

readable-names
Type: Boolean
Required: False
Default: yes
readable-names="no"

This attribute defines that filenames are made readable on import, i.e. underscores are replaced by space and extensions are removed. This changes the title of the entry if no metadata is available

case-sensitive-tags
Type: Boolean
Required: False
Default: yes
case-sensitive-tags="no"

This attribute defines that virtual paths are case sensitive, e.g. artist names like Ace Of Grace and Ace of Grace are treated as different (yes) or identical (no). This changes the location property of created virtual entries.

import-mode
Type: Enum grb|mt
Required: False
Default: mt
import-mode="grb"

This attribute sets the import process:

  • mt: traditional mode, that handles each file completely

  • grb: modern mode, that first imports all files and then processes the layout of the files

2.1.2 Import Items

2.1.2.1 Filesystem Charset

filesystem-charset
Type: String
Required: False
Default: if nl_langinfo() function is present, this setting will be auto detected based on your system locale, else set to UTF-8.
<filesystem-charset>UTF-8</filesystem-charset>

Defines the charset of the filesystem. For example, if you have file names in Cyrillic KOI8-R encoding, then you should specify that here. The server uses UTF-8 internally, this import parameter will help you to correctly import your data.

2.1.2.2 Metadata Charset

metadata-charset
Type: String
Required: False
Default: if nl_langinfo() function is present, this setting will be auto detected based on your system locale, else set to UTF-8.
<metadata-charset>UTF-8</metadata-charset>

Same as above, but defines the charset of the metadata (i.e. id3 tags, Exif information, etc.). This can be overwritten by the character set selection of the metadata library.

2.1.2.3 Magic File

magic-file
Type: String
Required: False
Default: System default
<magic-file>/path/to/my/magic-file</magic-file>

Specifies an alternative file for filemagic, containing mime type information.

2.2 Scripting

scripting
Type: Section
Required: False
<scripting script-charset="UTF-8" scan-mode="inotify">

Defines the scripting section.

2.2.1 Scripting Attributes

2.2.1.1 Character Set

script-charset
Type: String
Required: False
Default: UTF-8
script-charset="Latin1"

Change character set for scripts.

2.2.1.2 Scan Mode for Script Folders

scripting scan-mode
Type: Enum (manual|inotify|timed)
Required: False
Default: manual

Added in version 2.6.1.

scan-mode="inotify"

Set mode to rescan script-folders.

Mode

Meaning

manual

folders are only rescanned on startup

inotify

changes are detected automatically and scripts are reloaded
if gerbera is compiled with inotify support

timed

folder is rescanned after scripting scan-interval

2.2.1.3 Timed Scan Interval

scripting scan-interval
Type: Time
Required: False
Default: 48:00
scan-interval="24:00"

Set interval in minutes to rescan script-folders if scripting scan-mode is set to timed.

2.2.2 Scripting Items

Below are the available scripting options:

2.2.2.1 Script Folders

script-folder
Type: Section
Required: True

Added in version 2.0.

<script-folder>
    <common>/usr/local/share/gerbera/js</common>
    <custom>/home/dev/Source/gerbera/scripts/js</custom>
</script-folder>

Defines the locations of the script folders. If set, first all Javascript files from common are loaded and then all Javascript files from custom. If a function is defined in a common and a custom file the custom defintion overwrites the common defintion. No function should be duplicate in the same folder as loading order is not defined.

Setting script-folder is the replacement for setting the various script files with the former option common-script and import-script.

script-folder common
Type: Path
Required: True
Default: ${prefix}/share/gerbera/js, where ${prefix} is your installation prefix directory.
<common>/usr/local/share/gerbera/js</common>

Define the path to preinstalled script files. The files are part of the gerbera installation and should not be changed, because they may be overwritten by an update.

script-folder custom
Type: Path
Required: False
<custom>/etc/gerbera/js</custom>

Path for custom layout import scripts. Functions defined in js files in this folder are added to the script library.

2.2.2.2 Layout Functions

import-function
Type: Section
Required: True

Added in version 2.0.

<import-function>
    <audio-file>importAudioInitial</audio-file>
    <video-file>importVideo</video-file>
    <image-file>importImage</image-file>
    <playlist create-link="yes">importPlaylist</playlist>
    <meta-file>importMetadata</meta-file>
</import-function>

Set the entry points for the virtual layout functions and file parsing functions. Selecting the entry point is the replacement for setting the layout type in audio-layout. The entry points are directly called for Gerbera code and must have a defined synopsis. For further details see Scripting.

audio-file
Type: String
Required: False
Default: importAudio

Name of the javascript function called to create the virtual layout for an audio file. In addition to importAudio also importAudioStructured and importAudioInitial are part of gerbera installation.

video-file
Type: String
Required: False
Default: importVideo

Name of the javascript function called to create the virtual layout for a video file.

image-file
Type: String
Required: False
Default: importImage

Name of the javascript function called to create the virtual layout for an image file.

playlist
Type: String
Required: False
Default: importPlaylist

Name of the javascript function called to parse a playlist file.

Type: Boolean
Required: False
Default: yes
create-link="no"

Links the playlist to the virtual container which contains the expanded playlist items. This means, that if the actual playlist file is removed from the database, the virtual container corresponding to the playlist will also be removed.

meta-file
Type: String
Required: False
Default: importMetadata

Name of the javascript function invoked during the first import phase to gather metadata from additional files. Currently support for nfo files is implemented (https://kodi.wiki/view/NFO_files/Templates).

The search pattern to identify metadata files is set in resources section.

2.2.2.3 Virtual Layout

virtual-layout
Type: Section
Required: True
<virtual-layout type="builtin" audio-layout="Default">

Defines options for the virtual container layout; the so called ”virtual container layout” is the way how the server organizes the media according to the extracted metadata. For example, it allows sorting audio files by Album, Artist, Year and so on.

virtual-layout type
Type: Enum (builtin|js|disabled)
Required: False
Default: js if gerbera was compiled with javascript support, builtin otherwise.
type="js"

Specifies what will be used to create the virtual layout, possible values are:

  • builtin: a default layout will be created by the server

  • js: a user customizable javascript will be used (Gerbera must be compiled with js support)

  • disabled: only PC-Directory structure will be created, i.e. no virtual layout

Specifies the virtual layout to be created:

audio-layout
Type: String
Required: False
Default: Default

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

  • Default: addAudio is used to create the virtual layout

  • Structured: addAudioStructured is used to create the virtual layout (only in combination with javascript)

video-layout
Type: String
Required: False
Default: Default

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

image-layout
Type: String
Required: False
Default: Default

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

The virtual layout can be adjusted using an import script which is defined as follows:

audio-layout="Default|Structured"
video-layout="Default"
image-layout="Default"

2.2.2.4 Layout Scripts (deprecated)

common-script
Type: Path
Required: False
Default: ${prefix}/share/gerbera/js/common.js, where ${prefix} is your installation prefix directory.

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

Changed in version 2.0: Was required until 2.0, if virtual layout type is “js”.

<common-script>/path/to/my/common-script.js</common-script>

Points to the so called common script - it is a shared library of js helper functions. For more details read scripting

custom-script
Type: Path
Required: False
Default: empty

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

<custom-script>/path/to/my/custom-script.js</custom-script>

Points to the custom script - think of it as a custom library of js helper functions, functions added there can be used in your import and in your playlist scripts. Theses functions also overwrite functions from the common script. For more details read scripting

import-script
Type: Path
Required: False
Default: ${prefix}/share/gerbera/js/import.js, where ${prefix} is your installation prefix directory.

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

Changed in version 2.0: Was required until 2.0, if virtual layout type is “js”.

<import-script>/path/to/my/import-script.js</import-script>

Points to the script invoked upon media import. For more details read about scripting.

playlist-script
Type: Path
Required: False
Default: ${prefix}/share/gerbera/js/playlists.js, where ${prefix} is your installation prefix directory.

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

Changed in version 2.0: Was required until 2.0, if virtual layout type is “js”.

<playlist-script create-link="yes">/path/to/my/playlist-script.js</playlist-script>

Points to the script that is parsing various playlists, by default parsing of pls, m3u and asx playlists is implemented, however the script can be adapted to parse almost any kind of text based playlist. For more details read scripting

Type: Boolean
Required: False
Default: yes
create-link="no"

Links the playlist to the virtual container which contains the expanded playlist items. This means, that if the actual playlist file is removed from the database, the virtual container corresponding to the playlist will also be removed.

metafile-script
Type: Path
Required: False
Default: ${prefix}/share/gerbera/js/metadata.js, where ${prefix} is your installation prefix directory.

Removed in version 3.0.0: Migrate your configuration to use 2.2.2.2   Layout Functions.

Changed in version 2.0: Was required until 2.0, if virtual layout type is “js”.

<metafile-script>/path/to/my/metadata-script.js</metafile-script>

Points to the main metadata parsing script which is invoked during the first import phase to gather metadata from additional files. Currently support for nfo files is implemented (https://kodi.wiki/view/NFO_files/Templates).

The search pattern is set in resources section.

2.2.2.5 Structured Layout

structured-layout
Type: Section
Required: False
<structured-layout skip-chars="" div-char="-" />

Adjust layout of boxes for large collections in structured layout. Set audio-file to importAudioStructured and choose values best for your media library.

div-char
Type: String
Required: False
Default: -
div-char="+"

Symbols to use around the box text.

skip-chars
Type: String
Required: False
Default: -
skip-chars="+-"

Special characters in the beginning of a title that are not used for building a box.

2.2.2.6 Script Options

script-options
Type: Section
Required: False
<script-options></script-options>

Contains options to pass into scripts. All values are available in scripts as e.g. config['/import/scripting/virtual-layout/script-options/script-option'].test. For more details see scripting

Child tags:

script-option
Type: Section
Required: False
<script-option name="test" value="42"/>

Set option value for option name.

script-option name
Type: String
Required: True
name="test"

Name of the option.

script-option value
Type: String
Required: True
value="42"

Value of the option.

2.2.3 Mapping for Genres

Media files are tagged with a variety of genres. The goal of genre-mapping is to move serveral of these original genres into the same box instead of creating a box for each genre.

genre-map
Type: Section
Required: False
<genre-map>
   <genre from="Special Disco Mix" to="Pop"/>
</genre-map>

Define mapping of genres to other text. Genres is relevant for virtual-layout type builtin and js regardless of its position in the configuration file.

2.2.3.1 Genre

genre
Type: Section
Required: False
<genre from="Special Disco Mix" to="Pop"/>

Replace genre from by genre to.

genre from
Type: String
Required: True
from="Special Disco Mix"

Original genre value. Can be a regular expression.

genre to
Type: String
Required: True
to="Pop"

Target genre value.

2.2.4 Mapping for Camera Models

Camera model values as taken from exif tags are sometimes unstructured across manufacturers. The goal of model-mapping is to unify values in your media library.

model-map
Type: Section
Required: False

Added in version 3.1.0.

<model-map>
   <model from="X6-00" to="Nokia X6"/>
</model-map>

Define mapping of camera model value.

2.2.4.1 Camera Model

model-map model
Type: Section
Required: False
<model from="X6-00" to="Nokia X6"/>

Replace model from by genre to.

model-map model from
Type: String
Required: True
from="X6-00"

Original model value. Can be a regular expression.

model-map model to
Type: String
Required: True
to="Nokia X6"

Target model value.

2.2.5 Rules for Headlines for Topics Section

The topics section in virtual layout combines files from images and videos and is populated with the respective import-function. The headlines (call topic and subtopic) in this section are derived from media description or special properties as implemented in the imoort function..

headline-map
Type: Section
Required: False

Added in version 3.1.0.

<headline-map>
  <headline from="Gerbera" to="Gerbera" type="Topic"/>
  <headline from="Gerbera[- ]*([^ ].*)" to="$1" type="SubTopic"/>
  <headline from="^(?!.*\d{4}).*$" to="" type="Ignore"/>
</headline-map>

Define mapping to build the headlines in topic section.

2.2.5.1 Headline

headline-map headline
Type: Section
Required: False
<headline from="Gerbera" to="Gerbera" type="Topic"/>

Set headline of type to to if source property matches from.

headline-map headline from
Type: String
Required: True
from="Gerbera"

Original headline value. Can be a regular expression. It is applied to the description of images. The property topic and subtopic is taken from NFO files for videos. If the property matches its source property the headline-map headline type defines the topic level to be set.

headline-map headline to
Type: String
Required: True
to="Nokia X6"

Target headline value.

headline-map headline type
Type: Enum (Topic|SubTopic|Ignore)
Required: False
Default: SubTopic
type="Ignore"

Set type of topic level to be referenced. Ignore means that the headline-map headline to and the whole item is ignored.

2.2.6 Properties of Layout Boxes

boxlayout
Type: Section
Required: False
Default: Extensible Default: Without extend="true" all missing entries are reported

Added in version 2.0.0.

<boxlayout extend="true">
   <box key="Audio/myBox" title="New" class="object.container.album.musicAlbum" size="8" enabled="yes" />
</boxlayout>

Boxlayout is relevant for virtual-layout type builtin and js regardless of its position in the configuration file.

2.2.6.1 Box Properties

box
Type: Section
Required: False
<box key="Audio/myBox" title="New" class="object.container.album.musicAlbum" size="8" enabled="yes" />

Set properties for box.

box key
Type: String
Required: True
key="Audio/audioRoot"

Configure Box key. The key that is used in javascript and builtin layout to refer the the config.

box title
Type: String
Required: True
title="Music"

The title to use for the respective box.

box class
Type: String
Required: False
Default: object.container
class="object.container.album.musicAlbum"

Set the upnp class for the respective box.

box upnp-shortcut
Type: String
Required: False
Default: empty

Added in version 2.4.0.

upnp-shortcut="MUSIC_ARTISTS"

Set the upnp shortcut label for this box. The last container created based on this box will be added to the shortcuts feature field. For more details see UPnP-av-ContentDirectory-v4-Service, page 357.

box sort-key
Type: String
Required: False
Default: empty

Added in version 2.6.0.

sort-key="0123"

Define special sorting key for the box instead of its title.

box enabled
Type: Boolean
Required: False
Default: yes
enabled="no"

Disable the respective box. Disabling boxes depends on support by the respective layout.

box searchable
Type: Boolean
Required: False
Default: yes

Added in version 3.0.0.

searchable="no"

Activate/deactivate box content for search. Especially relevant for artists, albums and genres. To avoid duplicate results in search only one box of each type should be searchable. The respective layout may overwrite the setting to enforce this rule.

box size
Type: Interval
Required: False
Default: 1
size="6"

Type of the box in structured layout. The following values are supported

  • 1: One large box

  • 2: Two boxes with 13 items each

  • 3: Boxes with 8, 9, 9 letters

  • 4: Boxes with 7, 6, 7, 6 letters

  • 5: Boxes with 5, 5, 5, 6, 5 letters

  • 6: Boxes with 4, 5, 4, 4, 5, 4 letters

  • 7: Boxes with 4, 3, 4, 4, 4, 3, 4 letters

  • 9: Boxes with 5, 5, 5, 4, 1, 6 letters; a large box for T

  • 13: Boxes with 2 letters each

  • 26: A speparate box for each letter

2.2.6.2 Layout Sub Trees

chain
Type: Section
Required: False

Added in version 2.6.0.

<chain type="audio|video|image">
  <link key=".." />
</chain>

Define a user specific sub tree in virtual layout. Only available for js layout.

chain type
Type: Enum (audio|video|image)
Required: True
type="audio|video|image"

Set the import script type where the chain is added. Valid values are: audio, video and image.

Child tags:

Type: Section
Required: False
<link key="Audio/audioTest" title="obj.title" metaData="obj.metaData" />
<link key="Audio/audioRoot"/>

Define or reference link in chain.

Attributes:

Type: String
Required: True
key="Audio/audioRoot"

Either the key of an existing <box> or the identifier of a new box.

Type: String
Required: False
title="obj.title"
class="'object.container.genre.musicGenre'"
upnpShortcut="''"
sortKey="'0000' + obj.title"
res="obj.res"
aux="obj.aux"
refID="obj.id"

Set the properties of the container to be created. Property stateents are evaluated in javascript with obj and media objects as sources. Constant values must be enclosed in ticks ''.

Type: String
Required: False
metaData="obj.metaData"
metaData="M_ALBUM: obj.metaData[M_ALBUM], M_ARTIST: obj.metaData[M_ALBUMARTIST]"

Define the metadata of the new container. For metadata there is a second format for the properties: M_ALBUM: obj.metaData[M_ALBUM], M_ARTIST: obj.metaData[M_ALBUMARTIST]. Individual metadata properties can be set and must be separated by commas. The list of available properties can be found in scripting.

2.3 Autoscan

autoscan
Type: Section
Required: False
<autoscan use-inotify="auto" inotify-attrib="yes">

Specifies a list of default autoscan directories.

This section defines persistent autoscan directories. It is also possible to define autoscan directories in the UI, the difference is that autoscan directories that are defined via the config file can not be removed in the UI. Even if the directory gets removed on disk, the server will try to monitor the specified location and will re add the removed directory if it becomes available/gets created again.

2.3.1 Autoscan Attributes

use-inotify
Type: Enum (yes|no|auto)
Required: False
Default: auto
use-inotify="yes"

Specifies if the inotify autoscan feature should be enabled. The default value is auto, which means that availability of inotify support on the system will be detected automatically, it will then be used if available. Setting the option to ‘no’ will disable inotify even if it is available. Allowed values: “yes”, “no”, “auto”

inotify-attrib
Type: Boolean
Required: False
Default: no

Added in version 2.2.0.

inotify-attrib="yes|no"

Specifies if the inotify will also monitor for attribute changes like owner change or access given.

2.3.2 Autoscan Directory

directory
Type: Section
Required: False
<directory location="/media" mode="timed" interval="3600"
           recursive="no" hidden-files="no"/>
<directory location="/audio" mode="inotify"
           recursive="yes" hidden-files="no"/>
<directory location="/video" mode="manual"
           recursive="yes" hidden-files="no"/>

Defines an autoscan directory and it’s parameters.

2.3.2.1 Directory Attributes

directory location
Type: Path
Required: True
location=...

Absolute path to the directory that shall be monitored.

directory mode
Type: Enum (inotify|timed|manual)
Required: True
mode="inotify|timed|manual"

The values have the following meaning:

  • timed mode rescans the given directory in specified intervals

  • inotify mode uses the kernel inotify mechanism to watch for filesystem events.

  • manual requires user interaction on web ui.

directory interval
Type: Time
Required: True
interval="1500"

Scan interval in seconds. The value can be given in a valid time format.

directory recursive
Type: Boolean
Required: True
Default: no
recursive="yes"

Specifies if autoscan shall monitor the given directory including all sub directories.

directory dirtypes
Type: Boolean
Required: False
Default: yes

Added in version 2.3.0.

dirtypes="no"

Specifies if containers in PC Directory will get container types like albums based on the majority of child items.

directory hidden-files
Type: Boolean
Required: False
Default: value specified in import hidden-files
hidden-files="no"

Process hidden files, overrides the hidden-files value in the <import/> tag.

Type: Boolean
Required: False
Default: value specified in import follow-symlinks

Added in version 2.0.0.

follow-symlinks="no"

Symbolic links should be treated as regular items and imported into the database (yes). This can cause duplicate entries if the link target is also scanned overrides the follow-symlinks value in the <import/> tag.

directory retry-count
Type: Integer (non-negative)
Required: False
Default: 0

Added in version 2.2.0.

retry-count="3"

This attribute can be used to allow multiple attempts to access files in case of mounted volumes. In some cases inotify events are raised before the directory or file is fully available, causing an access permission error and the import fails. This attribute is only available in config.xml at the moment.

force-reread-unknown
Type: Boolean
Required: False
Default: no

Added in version 2.5.0.

force-reread-unknown="yes"

This attribute forces that files without changes are reread (on startup) if their upnp class is unset or “object.item”. This can happen if the first scan (e.g. via inotify) did not get all details of the file correctly. This is mostly the case if the media folder is exported on the network and files are written via network. Be aware that the startup will take longer if there is a large number of non-media files in the folder

media-type
Type: String
Required: False
Default: Any
media-type="Music|AudioBook"

Only import audio/image/video from directory to virtual layout if upnp class is subclass. Values can be concatenated by |. Allowed values are:

Value

Upnp Class

Any

object.item

Audio

object.item.audioItem

Music

object.item.audioItem.musicTrack

AudioBook

object.item.audioItem.audioBook

AudioBroadcast

object.item.audioItem.audioBroadcast

Image

object.item.imageItem

Photo

object.item.imageItem.photo

Video

object.item.videoItem

Movie

object.item.videoItem.movie

MusicVideo

object.item.videoItem.musicVideoClip

TV

object.item.videoItem.videoBroadcast

container-type-audio
Type: String
Required: False
Default: object.container.album.musicAlbum
container-type-image
Type: String
Required: False
Default: object.container.album.photoAlbum
container-type-video
Type: String
Required: False
Default: object.container
container-type-audio="object.container"
container-type-image="object.container"
container-type-video="object.container"

Set the default container type for virtual containers and for physical containers in grb-mode during import. This is especially useful if the virtual layout simulates the filesystem structure and is not derived from metadata. The first object that is added to the container determines the property (audio/image/video) used.

2.4 System Directories

system-directories
Type: Section
Required: False
Default: Extensible Default, see extend
<system-directories>
   <add-path name="/sys"/>
</system-directories>

Specifies a list of system directories hidden in filesystem web ui.

If the element does not exists, the default list of system directories is set to /bin, /boot, /dev, /etc, /lib, /lib32, /lib64, /libx32, /proc, /run, /sbin, /sys, /tmp, /usr, /var.

2.4.1 Path

system-directories add-path
Type: Section
Required: False
<add-path name="/sys"/>

Defines a system directory.

system-directories add-path name
Type: Path
Required: True
name="/sys"

Absolute path to the directory that shall be hidden.

2.5 Visible Directories

visible-directories
Type: Section
Required: False
Default: Extensible Default, see extend
<visible-directories>
    <add-path name="/home/media"/>
</visible-directories>

Specifies a list of system directories visible in filesystem web ui. It can contain any path which is accessible by the gerbera server.

If the element exists it supercedes system-directories, i.e., only visible directories can be selected in web ui. This is the more forward way of defining content but cannot be defaulted.

2.5.1 Path

visible-directories add-path
Type: Section
Required: False
<add-path name="/home/media"/>

Defines a visible directory.

The attributes specify various options:

visible-directories add-path name
Type: Path
Required: True
name="/home/media"

Absolute path to the directory that shall be visible.

2.6 Virtual Layout Details

layout
Type: Section
Required: False
<layout parent-path="yes">
  <path from="Videos/Action" to="Action-Videos"/>
</layout>

Defines various layout options for generated virtual layout.

parent-path
Type: Boolean
Required: True
Default: no
parent-path="yes"

Values of yes or no are allowed, specifies if parent path is added to virtual layout. If set to no “/home/…/Videos/Action/a.mkv” with rootpath “/home/…/Videos” becomes “Action” otherwise “Videos/Action”. Setting to yes produces the layout of gerbera before version 1.5.

2.6.1 Path

layout path
Type: Section
Required: False
<path from="Videos/Action" to="Action-Videos"/>

Map a virtual path element. This allows reducing path elements or merging different sources into a common tree. Thema replacement is executed after calculation of virtual layout, i.e. after builtin or js layout script.

path from
Type: String
Required: True
from="..."

Source path. Can be a regular expression.

path to
Type: String
Required: True
to="..."

Target path. / can be used to create sub structure.

2.7 Resource Files

resources
Type: Section
Required: False
<resources case-sensitive="yes">

Defines various resource options for file based resources. Older versions of Gerbera added sereral files automatically. For performance reasons no pattern is added by default anymore. You can set up your correct fanart file by yourself, if no image is embedded in your media. If you have subtitle files, add the correct pattern, also.

case-sensitive
Type: Boolean
Required: False
Default: yes
case-sensitive="no"

This attribute defines whether search patterns are treated case sensitive or not, i.e. if set to no the file name cover.png matches anything like Cover.PNG or cover.PNG.

2.7.1 Resource Order

order
Type: Section
Required: False
<order>...</order>

Define the order in which the metadata is rendered in the output

2.7.1.1 Handler

handler
Type: Section
Required: False
<handler name="Fanart"/>
handler name
Type: String
Required: True
name="..."

Valid handler names are Default, LibExif, TagLib, Transcode, Fanart, Exturl, MP4, FFmpegThumbnailer, Flac, Matroska, Subtitle, Resource, ContainerArt

2.7.2 Resource Files

container
Type: Section
Required: False
Default: Extensible Default, see extend
fanart
Type: Section
Required: False
Default: Extensible Default, see extend
subtitle
Type: Section
Required: False
Default: Extensible Default, see extend
metafile
Type: Section
Required: False
Default: Extensible Default, see extend
resource
Type: Section
Required: False
Default: Extensible Default, see extend
<container location="images" parentCount="2" minDepth="2">
   <add-file name="folder.jpg" />
   <add-file name="poster.jpg" />
   <add-file name="cover.jpg" />
   <add-file name="albumartsmall.jpg" />
</container>
<fanart>
   <add-dir name="." pattern="%filename%" mime="image/*" />
   <add-file name="%title%.jpg" />
   <add-file name="%filename%.jpg" />
   <add-file name="%album%.jpg" />
</fanart>
<subtitle>
   <add-dir name="." pattern="%filename%" mime="application/x-srt" />
</subtitle>
<metafile>...</metafile>
<resource>...</resource>

Define file patterns to search for fanart, subtitle, metafiles and resources respectivly.

container, fanart, metafile and subtitle patterns are used to identify external resources which are added to each item if the pattern matches.

resource patterns are used to trigger rescan of the whole directory if such a file was changed, added or removed.

Each of these tags can contain multiple add-file or add-dir entries. container has additional attributes.

2.7.2.1 Container

Set up container images. The fanart of a media file is added automatically as a thumbnail to the container (e.g. the album container). The setting depends on the chosen layout and is only fully respected if the layout script does not set own properties (which was the case in older javascript layouts).

resource container location
Type: Path
Required: False
Default: empty
location="/mnt/images"

Path to the directory containing the images to load. Relative paths are assumed to be under the server’s home. Drop your artists’ images or logos for default containers here and they are displayed as thumbnail when browsing with a compatible client. If the image is not found in that location, it is also searched in the physical folder itself.

parentCount
Type: Integer
Required: False
Default: 2
parentCount="4"

This setting allows to increase the number of levels which the fanart of a media file can be propagated upwards (examples refer to basic layout /Root/Audio/Artist/Album/song). A value of 1 adds the fanart only to the direct parent container when a media file is added (e.g. the Album container). A value of 2 means you propagate that image to the parent container as well (e.g. the Artist container). A value of 0 blocks propagation completely.

minDepth
Type: Integer
Required: False
Default: 2
minDepth="1"

Depending on the virtual layout propagating thumbnails can reach containers like Video or Audio. This settings forces a minimal depth for propagation to apply. It is setting the minimum number of path elements for container using fanart from media files (e.g. /Root/Audio/Artist has level 3 so the image can be set).

2.7.2.2 Resource File Pattern

File patterns can be configured for each resource type.

resource add-file
Type: Section
Required: False
<add-file name="cover.png"/>
<add-file name="%filename%.srt"/>
resource add-file name
Type: String
Required: True
name="..."

Add file search pattern to resource handler. The search pattern can contain variables:

  • %album%: Value of the album tag

  • %albumArtist%: Value of the albumArtist tag

  • %artist%: Value of the artist tag

  • %filename%: Name of the file without extension or name of the container

  • %genre%: Value of the genre tag

  • %title%: Value of the title tag

  • %composer%: Value of the composer tag

2.7.2.3 Resource Directory Pattern

resource add-dir
Type: Section
Required: False
<add-dir name="/data/subtitles/%title%" ext="srt"/>
<add-dir name="/data/subtitles" ext="%title%*.srt"/>
<add-dir name="%filename%" ext="srt"/>
<add-dir pattern="%filename%*" ext="srt"/>
<add-dir name="." pattern="%filename%*" mime="image/*"/>
resource add-dir name
Type: String
Required: True
name="..."

Add directory search pattern to resource handler. The search pattern can contain the same variables as resource add-file name. If the directory is relative the file is searched in a subdirectory of the directory containing the media file. If the directory is empty or just . it is replaced by the directory of the media file.

resource add-dir ext
Type: String
Required: False
ext="..."

Define the extension or file name pattern. The search pattern can contain the same variables as resource add-file name. If it does not contain a . it is considered as extension. If it contains a . the part before can contain * and ? as wildcards and must exactly match the resource file name.

resource add-dir pattern
Type: String
Required: False
pattern="..."

Define the file name pattern in the directory. The search pattern can contain the same variables as resource add-file name. It can contain * and ? as wildcards and must exactly match the resource file name.

resource add-dir mime
Type: String
Required: False
mime="image/*"

Define the mime type to search for with pattern as name. Specifying a mime type allows omitting the extension in conjunciton with extension-to-mimetype-mapping.

A sample configuration would be:

<resources case-sensitive="no">
    <fanart>
        <add-file name="cover.png"/>
        <add-dir name="." pattern="%filename%*" mime="image/*"/>
    </fanart>
    <subtitle>
        <add-file name="%filename%.srt"/>
        <add-dir name="/data/subtitles/%title%" ext="srt"/>
        <add-dir pattern="%filename%*" ext="srt"/>
    </subtitle>
    <resource>
        <add-file name="cover.png"/>
        <add-file name="%filename%.srt"/>
    </resource>
</resources>

2.8 Mappings

mappings
Type: Section
Required: False
<mappings>...</mappings>

Defines various mapping options for importing media, currently two subsections are supported.

This section defines mime type and upnp:class mappings, it is vital if filemagic is not available - in this case media type auto detection will fail and you will have to set the mime types manually by matching the file extension. It is also helpful if you want to override auto detected mime types or simply skip filemagic processing for known file types.

2.8.1 Ignored Extensions

ignore-extensions
Type: Section
Required: False
<ignore-extensions>
   <add-file name="part"/>
</ignore-extensions>

This section holds the extensions to exclude from metdata handling.

2.8.1.1 Extension

ignore-extensions add-file
Type: Section
Required: False
<add-file name="part"/>
ignore-extensions add-file name
Type: String
Required: True
name="..."

Specifies a file name extension (everything after the last dot “.”) to ignore.

Note:

This improves the import speed, because files are ignored completely.

Note:

The extension is case sensitive, if extension-mimetype case-sensitive is set to yes

2.8.2 Map Extension to Mimetype

extension-mimetype
Type: Section
Required: False
Default: Extensible default, see extend
<extension-mimetype ignore-unknown="no" case-sensitive="no">
    <map from="mp3" to="audio/mpeg"/>
</extension-mimetype>

This section holds the file name extension to mime type mappings.

2.8.2.1 Attributes

extension-mimetype ignore-unknown
Type: String
Required: True
Default: no
ignore-unknown="yes"

If ignore-unknown is set to “yes”, then only the extensions that are listed in this section are imported.

extension-mimetype case-sensitive
Type: String
Required: True
Default: no
case-sensitive="yes"

Specifies if extensions listed in this section are case sensitive.

2.8.2.2 Extension Map

extension-mimetype map
Type: Section
Required: False
<map from="mp3" to="audio/mpeg"/>
extension-mimetype map from
Type: String
Required: True
from="mp3"
extension-mimetype map to
Type: String
Required: True
to="audio/mpeg"

Specifies a mapping from a certain file name extension (everything after the last dot “.”) to mime type.

Note:

This improves the import speed, because invoking libmagic to discover the right mime type of a file is omitted for files with extensions listed here.

Note:

The extension is case sensitive, if extension-mimetype case-sensitive is set to yes

2.8.3 Map Mimetype to Upnpclass

mimetype-upnpclass
Type: Section
Required: False
Default: Extensible default, see extend
<mimetype-upnpclass>
   <map from="audio/*" to="object.item.audioItem.musicTrack"/>
</mimetype-upnpclass>

This section holds the mime type to upnp:class mappings.

2.8.3.1 Mimetype Map

mimetype-upnpclass map
Type: Section
Required: False
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
mimetype-upnpclass map from
Type: String
Required: True
from="audio/*"

Set source mimetype.

mimetype-upnpclass map to
Type: String
Required: True
to="object.item.audioItem.musicTrack"

Set target UPnPClass.

Specifies a mapping from a certain mime type to upnp:class in the Content Directory. The mime type can either be entered explicitly audio/mpeg or using a wildcard after the slash audio/*. The values of mimetype-upnpclass map from and mimetype-upnpclass map to attributes are case sensitive.

For detailled mapping the mimetype-upnpclass map from attribute can specify further filtering criteria like upnp:genre=Book which is expanded to if genre contains Book.

  • Example

<mimetype-upnpclass>
  <map from="application/ogg" to="object.item.audioItem.musicTrack"/>
  <map from="audio/*" to="object.item.audioItem"/>
  <map from="audio/*;tracknumber>0" to="object.item.audioItem.musicTrack"/>
  <map from="audio/*;upnp:genre=Book" to="object.item.audioItem.audioBook"/>
  <map from="image/*" to="object.item.imageItem"/>
  <map from="image/*;location=Camera" to="object.item.imageItem.photo"/>
  <map from="video/*" to="object.item.videoItem"/>
</mimetype-upnpclass>

2.8.4 Map Mimetype to DLNA TransferMode

mimetype-dlnatransfermode
Type: Section
Required: False
Default: Extensible default, see extend
<mimetype-dlnatransfermode>
 <map from="audio/*" to="Streaming"/>
<mimetype-dlnatransfermode>

This section holds the mime type to dlna transfer mode mappings. It is added to the http-header transferMode.dlna.org of the file request.

2.8.4.1 Mimetype Map

mimetype-dlnatransfermode map
Type: Section
Required: False
<map from="audio/*" to="Streaming"/>
<map from="video/*" to="Streaming"/>
<map from="image/*" to="Interactive"/>
<map from="text/*" to="Background"/>
mimetype-dlnatransfermode map from
Type: String
Required: True
from="audio/*"

Set source mimetype.

mimetype-dlnatransfermode map to
Type: Enum (Streaming|Interactive|Background)
Required: True
to="Streaming"

Set target DLNA transfermode.

Specifies a mapping from a certain mime type to transfer mode. The mime type can either be entered explicitly “audio/mpeg” or using a wildcard after the slash audio/*. The values of mimetype-dlnatransfermode map from and mimetype-dlnatransfermode map to attributes are case sensitive.

2.8.5 Map Mimetype to Contenttype

mimetype-contenttype
Type: Section
Required: False
Default: Extensible default, see extend
<mimetype-contenttype>
  <treat mimetype="audio/mpeg" as="mp3"/>
</mimetype-contenttype>

This section makes sure that the server knows about remapped mimetypes and still extracts the metadata correctly. If the user remaps mp3 files to a different mimetype, we must know about it so we can still pass this item to taglib for metadata extraction.

Note:

If this section is not present in your config file, the defaults will be filled in automatically. However, if you add an empty tag, without defining the following <treat> tags, the server assumes that you want to have an empty list and no files will be process by the metadata handler.

2.8.5.1 Map Mimetype

mimetype-contenttype treat
Type: Section
Required: False
<treat mimetype="audio/mpeg" as="mp3"/>

Tells the server what content the specified mimetype actually is in order to pick the correct DLNA profile.

mimetype-contenttype treat mimetype
Type: String
Required: True
mimetype="audio/mpeg"

Set source mimetype.

mimetype-contenttype treat as
Type: String
Required: True
as="mp3"

Set target content type.

It makes no sense to use values that are not defined in contenttype-dlnaprofile. The attribute can have addional values:

  • playlist: The content is a playlist and should be processed by the playlist parser script.

2.8.6 Map Contenttype to DLNA Profile

contenttype-dlnaprofile
Type: Section
Required: False
Default: Extensible default, see extend
<contenttype-dlnaprofile>
  <map from="mp4" videoCodec="h264" audioCodec="aac" to="AVC_MP4_MP_HD_720p_AAC"/>
</contenttype-dlnaprofile>

This section holds the content type to dlnaprofile mappings.

2.8.6.1 Map Content Type

contenttype-dlnaprofile map
Type: Section
Required: False
<map from="mp4" to="AVC_MP4_BL_CIF30_AAC_MULT5"/>
<map from="mp4" videoCodec="h264" audioCodec="aac" to="AVC_MP4_MP_HD_720p_AAC"/>

Specifies a mapping from a certain content type to a dlna profile in the Content Directory. In order to access special profiles you can specify a resource attribute with its required value. If multiple entries for the same mimetype exist, mappings with more details are preferred to simple from-to mappings. Resource attributes can be seen in the details page for an item on the web UI. The value must either match exactly the transformed value (incl. unit) or the raw value.

contenttype-dlnaprofile map from
Type: String
Required: True
from="mp4"

Set source content type.

contenttype-dlnaprofile map to
Type: String
Required: True
to="AVC_MP4_MP_HD_720p_AAC"

Set target DLNA profile.

Profile Catalog:

If you want to make your DLNA device play specific media the following list of profiles may be helpful:

<map from="asf" to="VC1_ASF_AP_L1_WMA"/>
<map from="asf" to="VC1_ASF_AP_L2_WMA"/>
<map from="asf" to="VC1_ASF_AP_L3_WMA"/>
<map from="avi" to="AVI"/>
<map from="dsd" to="DSF"/>
<map from="flac" to="FLAC"/>
<map from="flv" to="FLV"/>
<map from="gif" to="GIF_LRG"/>
<map from="jpg" to="JPEG_LRG"/>
<map from="jpg" to="JPEG_MED"/>
<map from="jpg" to="JPEG_SM"/>
<map from="jpg" to="JPEG_TN"/>
<map from="mkv" audioCodec="aac" to="AVC_MKV_HP_HD_AAC_MULT5"/>
<map from="mkv" to="AVC_MKV_HP_HD_DTS"/>
<map from="mkv" to="AVC_MKV_HP_HD_EAC3"/>
<map from="mkv" to="AVC_MKV_HP_HD_MLP"/>
<map from="mkv" to="AVC_MKV_HP_HD_MPEG1_L3"/>
<map from="mkv" audioCodec="aac" to="AVC_MKV_MP_HD_AAC_MULT5"/>
<map from="mkv" to="AVC_MKV_MP_HD_DTS"/>
<map from="mkv" to="AVC_MKV_MP_HD_EAC3"/>
<map from="mkv" to="AVC_MKV_MP_HD_MPEG1_L3"/>
<map from="mkv" to="MATROSKA"/>
<map from="mkv" audioCodec="ac3" to="AVC_MKV_HP_HD_AC3"/>
<map from="mkv" audioCodec="ac3" to="AVC_MKV_MP_HD_AC3"/>
<map from="mp3" to="MP2_MPS"/>
<map from="mp3" to="MP3"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF15_AAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF15_AAC_520"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF15_AAC_LTP"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF15_AAC_LTP_520"/>
<map from="mp4" to="AVC_MP4_BL_CIF15_AMR"/>
<map from="mp4" to="AVC_MP4_BL_CIF15_BSAC"/>
<map from="mp4" to="AVC_MP4_BL_CIF15_HEAAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF30_AAC_940"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF30_AAC_LTP"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF30_AAC_LTP_MULT5"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_CIF30_AAC_MULT5"/>
<map from="mp4" audioCodec="ac3" to="AVC_MP4_BL_CIF30_AC3"/>
<map from="mp4" to="AVC_MP4_BL_CIF30_BSAC"/>
<map from="mp4" to="AVC_MP4_BL_CIF30_BSAC_MULT5"/>
<map from="mp4" to="AVC_MP4_BL_CIF30_HEAAC_L2"/>
<map from="mp4" to="AVC_MP4_BL_CIF30_MPEG1_L3"/>
<map from="mp4" to="AVC_MP4_BL_L12_CIF15_HEAAC"/>
<map from="mp4" to="AVC_MP4_BL_L1B_QCIF15_HEAAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_L2_CIF30_AAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_L3L_SD_AAC"/>
<map from="mp4" to="AVC_MP4_BL_L3L_SD_HEAAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_BL_L3_SD_AAC"/>
<map from="mp4" to="AVC_MP4_EU"/>
<map from="mp4" to="AVC_MP4_HP_HD_DTS"/>
<map from="mp4" to="AVC_MP4_HP_HD_DTSHD"/>
<map from="mp4" to="AVC_MP4_HP_HD_MLP"/>
<map from="mp4" to="AVC_MP4_LPCM"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_MP_SD_AAC_LTP"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_MP_SD_AAC_LTP_MULT5"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_MP_SD_AAC_LTP_MULT7"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_MP_SD_AAC_MULT5"/>
<map from="mp4" to="AVC_MP4_MP_SD_ATRAC3plus"/>
<map from="mp4" to="AVC_MP4_MP_SD_BSAC"/>
<map from="mp4" to="AVC_MP4_MP_SD_DTS"/>
<map from="mp4" to="AVC_MP4_MP_SD_DTSHD"/>
<map from="mp4" to="AVC_MP4_MP_SD_HEAAC_L2"/>
<map from="mp4" to="AVC_MP4_MP_SD_MPEG1_L3"/>
<map from="mp4" to="HEVC_MP4"/>
<map from="mp4" to="MPEG4_P2_3GPP_SP_L0B_AMR"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_ATRAC3plus"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_HEAAC"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_HEAAC_MULT5"/>
<map from="mp4" audioCodec="ac3" to="MPEG4_P2_MP4_ASP_L4_SO_AAC"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_L4_SO_HEAAC"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_L4_SO_HEAAC_MULT5"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_ASP_L5_SO_AAC"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_L5_SO_HEAAC"/>
<map from="mp4" to="MPEG4_P2_MP4_ASP_L5_SO_HEAAC_MULT5"/>
<map from="mp4" to="MPEG4_P2_MP4_NDSD"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_SP_AAC"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_SP_AAC_LTP"/>
<map from="mp4" to="MPEG4_P2_MP4_SP_ATRAC3plus"/>
<map from="mp4" to="MPEG4_P2_MP4_SP_HEAAC"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_SP_L2_AAC"/>
<map from="mp4" to="MPEG4_P2_MP4_SP_L2_AMR"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_SP_VGA_AAC"/>
<map from="mp4" to="MPEG4_P2_MP4_SP_VGA_HEAAC"/>
<map from="mp4" audioCodec="aac" to="AVC_3GPP_BL_QCIF15_AAC"/>
<map from="mp4" videoCodec="av1" audioCodec="aac" to="AVC_MP4_HP_HD_AAC"/>
<map from="mp4" audioCodec="aac" to="AVC_MP4_MP_HD_1080i_AAC"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_3GPP_SP_L0B_AAC"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_ASP_AAC"/>
<map from="mp4" audioCodec="aac" to="MPEG4_P2_MP4_SP_L6_AAC"/>
<map from="mp4" videoCodec="h264" audioCodec="ac3" to="AVC_MP4_MP_SD_AC3"/>
<map from="mp4" videoCodec="h264" audioCodec="aac" to="AVC_MP4_MP_HD_720p_AAC"/>
<map from="mpa" audioCodec="aac" to="AAC_ISO"/>
<map from="mpa" audioCodec="aac" to="AAC_ISO_320"/>
<map from="mpeg" to="AVC_TS_DTSHD_MA_ISO"/>
<map from="mpeg" to="AVC_TS_DTSHD_MA_T"/>
<map from="mpeg" to="AVC_TS_HD_50_LPCM_T"/>
<map from="mpeg" to="AVC_TS_HD_DTS_ISO"/>
<map from="mpeg" to="AVC_TS_HD_DTS_T"/>
<map from="mpeg" to="AVC_TS_HP_HD_MLP"/>
<map from="mpeg" to="AVC_TS_HP_HD_MPEG1_L2_ISO"/>
<map from="mpeg" to="AVC_TS_HP_HD_MPEG1_L2_T"/>
<map from="mpeg" to="AVC_TS_HP_SD_MPEG1_L2_ISO"/>
<map from="mpeg" to="AVC_TS_HP_SD_MPEG1_L2_T"/>
<map from="mpeg" to="AVC_TS_MP_HD_MPEG1_L3"/>
<map from="mpeg" to="AVC_TS_MP_HD_MPEG1_L3_ISO"/>
<map from="mpeg" to="AVC_TS_MP_HD_MPEG1_L3_T"/>
<map from="mpeg" to="AVC_TS_MP_SD_MPEG1_L3"/>
<map from="mpeg" to="AVC_TS_MP_SD_MPEG1_L3_ISO"/>
<map from="mpeg" to="AVC_TS_MP_SD_MPEG1_L3_T"/>
<map from="mpeg" to="HEVC_TS"/>
<map from="mpeg" to="MPEG1"/>
<map from="mpeg" to="MPEG_PS_NTSC"/>
<map from="mpeg" to="MPEG_PS_PAL"/>
<map from="mpeg" to="MPEG_TS_JP_T"/>
<map from="mpeg" to="MPEG_TS_SD_EU"/>
<map from="mpeg" to="MPEG_TS_SD_EU_ISO"/>
<map from="mpeg" to="MPEG_TS_SD_EU_T"/>
<map from="mpeg" to="MPEG_TS_SD_KO"/>
<map from="mpeg" to="MPEG_TS_SD_KO_ISO"/>
<map from="mpeg" to="MPEG_TS_SD_KO_T"/>
<map from="mpeg" to="MPEG_TS_SD_NA"/>
<map from="mpeg" to="MPEG_TS_SD_NA_ISO"/>
<map from="mpeg" to="MPEG_TS_SD_NA_T"/>
<map from="mpeg" to="VC1_TS_HD_DTSHD_MA_ISO"/>
<map from="mpeg" to="VC1_TS_HD_DTSHD_MA_T"/>
<map from="mpeg" to="VC1_TS_HD_DTS_ISO"/>
<map from="mpeg" to="VC1_TS_HD_DTS_T"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_HD_AAC_MULT5"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_HD_AAC_MULT5_ISO"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_HD_AAC_MULT5_T"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_SD_AAC_MULT5"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_SD_AAC_MULT5_ISO"/>
<map from="mpeg" audioCodec="aac" to="AVC_TS_MP_SD_AAC_MULT5_T"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_HD_AC3"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_HD_AC3_ISO"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_HD_AC3_T"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_SD_AC3"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_SD_AC3_ISO"/>
<map from="mpeg" audioCodec="ac3" to="AVC_TS_MP_SD_AC3_T"/>
<map from="mpeg" audioCodec="ac3" to="VC1_TS_AP_L1_AC3_ISO"/>
<map from="mpeg" audioCodec="ac3" to="VC1_TS_AP_L2_AC3_ISO"/>
<map from="mwv" to="VC1_ASF_AP_L1_WMA"/>
<map from="mwv" to="VC1_ASF_AP_L2_WMA"/>
<map from="mwv" to="VC1_ASF_AP_L3_WMA"/>
<map from="mwv" to="WMVHIGH_FULL"/>
<map from="mwv" to="WMVHIGH_PRO"/>
<map from="mwv" to="WMVMED_BASE"/>
<map from="mwv" to="WMVMED_FULL"/>
<map from="mwv" to="WMVMED_PRO"/>
<map from="ogg" to="OGG"/>
<map from="ogg" to="OGV"/>
<map from="pcm" to="WAV"/>
<map from="pcm" sampleFrequency="44100" nrAudioChannels="1" to="LPCM16_44_MONO"/>
<map from="pcm" sampleFrequency="44100" nrAudioChannels="2" to="LPCM16_44_STEREO"/>
<map from="pcm" sampleFrequency="48000" nrAudioChannels="1" to="LPCM16_48_MONO"/>
<map from="pcm" sampleFrequency="48000" nrAudioChannels="2" to="LPCM16_48_STEREO"/>
<map from="png" to="PNG_LRG"/>
<map from="png" to="PNG_TN"/>
<map from="wma" to="WMABASE"/>
<map from="wma" to="WMAFULL"/>
<map from="wma" to="WMALSL"/>
<map from="wma" to="WMALSL_MULT5"/>
<map from="wma" to="WMAPRO"/>

Note

Feel free to provide us improvements to this list!

2.9 Virtual Directories

virtual-directories
Type: Section
Required: False
Default: Extensible default, see extend
<virtual-directories>
   <key metadata="M_ALBUMARTIST" class="object.container.album.musicAlbum"/>
   <key metadata="M_UPNP_DATE" class="object.container.album.musicAlbum"/>
   <key metadata="LOCATION" class="object.container.album.musicAlbum"/>
   <key metadata="M_ARTIST_1" class="object.container.album.musicAlbum"/>
</virtual-directories>

This section holds the additional identifiers for virtual directories to make sure, e.g. albums with the same title are distiguished by their artist even if the displayed text is identical.

2.9.1 Directory Identifier

virtual-directories key
Type: Section
Required: False
<key metadata="M_ARTIST" class="object.container.album"/>

Add additional identifier for directory of upnp class.

virtual-directories key metadata
Type: String
Required: True
metadata="M_ARTIST_1"

Specifies the metadata field to add for identification internally. For a list of valid metadata see Metadata. If _1 is added to the name of the key only the first item in the list is picked (if there are multiple like for M_ARTIST). In addition LOCATION references to the location property retrieved from the layout script.

virtual-directories key class
Type: String
Required: False
Default: empty
class="object.container.album"

Restrict the key to containers of the given upnp class.

2.10 Import Library Options

library-options
Type: Section
Required: False
<library-options>...</library-options>

This section holds options for the various supported import libraries, it is useful in conjunction with virtual container scripting, but also allows to tune some other features as well.

Currently the library-options allow additional extraction of the so called auxilary data (explained below) and provide control over the video thumbnail generation.

Here is some information on the auxdata: UPnP defines certain tags to pass along metadata of the media (like title, artist, year, etc.), however some media provides more metadata and exceeds the scope of UPnP. This additional metadata can be used to fine tune the server layout, it allows the user to create a more complex container structure using a customized import script. The metadata that can be extracted depends on the library, currently we support taglib, ffmpeg and libexif, matroska, wavpack and exiv2 (if compiled with respective library enabled) which provide a default set of keys that can be passed in the options below. The data according to those keys will the be extracted from the media and imported into the database along with the item. When processing the item, the import script will have full access to the gathered metadata, thus allowing the user to organize the data with the use of the extracted information. A practical example would be: having more than one digital camera in your family you could extract the camera model from the Exif tags and sort your photos in a structure of your choice, like:

  • Photos/MyCamera1/All Photos

  • Photos/MyCamera1/Date

  • Photos/MyCamera2/All Photos

  • Photos/MyCamera2/Date

etc.

2.10.1 General Attributes

multi-value-separator
Type: String
Required: False
Default: "; "
multi-value-separator="/ "

This string is used to join multi-valued items (e.g. Composer, Performer) into one string.

legacy-value-separator
Type: String
Required: False
Default: empty

This string is used to split items into lists before joining them with multi-value-separator. This option can be used to import files from legacy tools which did not support multi-valued items. The empty string is used to disable legacy handling.

2.10.2 Library Settings

Gerbera imports a set of common tags by default in order to populate UPnP content. If you need further properties there are two options

  • auxdata : Read the value in order to use it in an import script

  • metadata : Read value into in order to send it as UPnP property

The following library sections can contain both of these entries as well as a library charset and a library enabled attribute:

  • id3: Configure taglib settings used for audio file analysis.

  • libexiv: Configure libexiv settings used for image file analysis.

  • exiv2: Configure libexiv2 settings used for image file analysis.

  • wavpack: Configure libwavpack settings used for enhanced wavpack file analysis.

  • ffmpeg: Configure ffmpeg settings used for audio and video file analysis.

  • mkv: Configure libmatroska settings used for enhanced mkv file analysis.

2.10.2.1 Character Set

library charset
Type: String
Required: False
Default: value of metadata-charset

Overwrite the metadata-charset for the respective type of file.

2.10.2.2 Enable Library

library enabled
Type: Boolean
Required: False
Default: yes

Exclude the metadata parser from the import process.

2.10.3 Additional Library Data

auxdata
Type: Section
Required: False
<auxdata>
   <add-data tag="tag1"/>
</auxdata>

Auxdata can be read by the import javascript as aux to gain more control over the media structure. The available tags depend on the respective library.

2.10.3.1 Add Tags

auxdata add-data
Type: Section
Required: False
<add-data tag="tag1"/>
<add-data tag="tag2"/>
auxdata add-data tag
Type: String
Required: True
tag="tag1"

If the library was able to extract the data according to the given keyword, it will be added to auxdata. You can then use that data in your import scripts.

2.10.4 Metadata Assignment

metadata
Type: Section
Required: False
<metadata>
   <add-data tag="tag3" key="upnp:Key"/>
</metadata>

Metadata can be read by the import javascript as meta to gain more control over the media structure and is automatically added to the UPnP output.

2.10.4.1 Map Tags

metadata add-data
Type: Section
Required: False
<add-data tag="tag3" key="upnp:Key"/>

If the library was able to extract the data according to the given keyword, it will be added to metadata.

metadata add-data tag
Type: String
Required: True
tag="tag3"

Extract tag from media file.

metadata add-data key
Type: String
Required: True
key="upnp:Key"

Sets the UPnP meta property.

2.10.5 Filter Files by Content Type

libcontent
Type: Section
Required: False
Default: Extensible default, see extend

Added in version 3.2.0.

<libcontent enabled="yes">
   <add-libcontent contenttype="png"/>
</libcontent>

In case a content type is handled by multiple libraries, import time can increase significantly. To avoid parsing files twice, you can select the content types for handling by the library.

libcontent enabled
Type: Boolean
Required: False
Default: no
enabled="yes"

Enable filtering by the content type.

2.10.5.1 Add Content Type

libcontent add-libcontent
Type: Section
Required: False
<add-libcontent contenttype="png"/>
<add-libcontent contenttype="jpg"/>
libcontent add-libcontent contenttype
Type: String
Required: True
contenttype="jpg"

Select the content type.

If the library is not able to handle the content type the value is ignored.

2.10.6 Fabricate Comment

comment
Type: Section
Required: False

Added in version 2.5.0.

<comment enabled="yes"> ... </comment>

Fabricate a comment (description) from metadata. The comment will only be created if there is no description set and in the mechanism is enabled.

comment enabled
Type: Boolean
Required: False
Default: no
enabled="yes"

Enable fabricating comment by the library code.

2.10.6.1 Comment Detail

library comment
Type: Section
Required: False
<add-comment label="My favourite Detail" tag="MEDIA_TAG"/>

If the library was able to extract the data according to the given tag, it will be added to the comment.

library comment label
Type: String
Required: True
label="My favourite Detail"

Set the label shown before the tag value.

library comment tag
Type: String
Required: True
tag="MEDIA_TAG"

Set the media property.

2.10.7 Library Sections

2.10.7.1 LibExif

libexiv
Type: Section
Required: False
<libexif>...</libexif>

Configure libexiv settings used for image file analysis.

For a list of keywords/tags see the libexif documentation.

A sample configuration for the example described above would be:

<libexif>
    <auxdata>
        <add-data tag="EXIF_TAG_MODEL"/>
    </auxdata>
</libexif>

2.10.7.2 Taglib

id3
Type: Section
Required: False
<id3>...</id3>

Configure taglib settings used for audio file analysis.

The keywords are those defined in the specifications, e.g. ID3v2.4 or Vorbis comments. We do not perform any extra checking, so you could try to use any string as a keyword - if it does not exist in the tag nothing bad will happen.

Here is a list of some extra keywords not beeing part of UPnP:

  • ID3v2.4 / MP3: TBPM, TCOP, TDLY, TENC, TEXT, TFLT, TIT1, TIT3, TKEY, TLAN, TLEN, TMCL, TMED, TOAL, TOFN, TOLY, TOPE, TOWN, TPE4, TPOS, TPUB, TRSN, TRSO, TSOA, TSRC, TSSE, TXXX:Artist, TXXX:Work, …

  • Vorbis / FLAC: ALBUMSORT, ARTISTS, CATALOGNUMBER, COMPOSERSORT, ENCODEDBY, LYRICIST, ORIGINALDATE, PRODUCER, RELEASETYPE, REMIXER, TITLESORT, WORK, …

  • any other user defined keyword, for APEv2 or iTunes MP4, see e.g. table of mapping between various tagging formats at MusicBrainz.

A sample configuration for the example described above would be:

<id3>
    <auxdata>
        <add-data tag="TXXX:Work"/>
        <add-data tag="WORK"/>
        <add-data tag="TMCL"/>
    </auxdata>
    <metadata>
        <add-data tag="PERFORMER" key="upnp:artist@role[Performer]"/>
    </metadata>
</id3>

2.10.7.3 FFMpeg

ffmpeg
Type: Section
Required: False
<ffmpeg artwork-enabled="yes">...</ffmpeg>

Configure ffmpeg settings used for audio and video file analysis.

This page documents all of the metadata keys that FFmpeg honors, depending on the format being encoded.

artwork-enabled
Type: Boolean
Required: False
Default: no

Added in version 2.6.0.

artwork-enabled="yes"

Create a separate resource for the artwork if detected by ffmpeg instead of merging the attributes into the existing thumbnail resource (e.g. created by taglib)

streams-enabled
Type: Boolean
Required: False
Default: no

Added in version 3.2.0.

streams-enabled="yes"

Check all streams for metadata. Expect longer import times in case of large files.

subtitle-seek-size
Type: Integer
Required: False
Default: 2048

Added in version 3.0.0.

subtitle-seek-size="4096"

Number of bytes to read from a subtitle stream to identify the mime-type of an internal subtitle.

A sample configuration for the example described above would be:

<ffmpeg artwork-enabled="yes">
    <auxdata>
        <add-data tag="COLLECTION"/>
        <add-data tag="SHOW"/>
        <add-data tag="NETWORK"/>
        <add-data tag="EPISODE-ID"/>
    </auxdata>
    <metadata>
        <add-data tag="performer" key="upnp:artist@role[Performer]"/>
    </metadata>
</ffmpeg>

2.10.7.4 Exiv2

exiv2
Type: Section
Required: False
<exiv2>...</exiv2>

Configure libexiv2 settings used for image file analysis.

This page documents all of the metadata keys that exiv2 honors, depending on the format being encoded.

A sample configuration for the example described above would be:

<exiv2>
    <auxdata>
        <add-data tag="Exif.Image.Model"/>
        <add-data tag="Exif.Photo.DateTimeOriginal"/>
        <add-data tag="Exif.Image.Orientation"/>
        <add-data tag="Exif.Image.Rating"/>
        <add-data tag="Iptc.Application2.Subject"/>
        <add-data tag="Xmp.xmp.Rating" />
        <add-data tag="Xmp.dc.subject"/>
    </auxdata>
</exiv2>

2.10.7.5 Matroska

mkv
Type: Section
Required: False
<mkv>...</mkv>

Configure matroska aka mkv settings used for enhanced mkv file analysis.

2.10.7.6 WavPack

wavpack
Type: Section
Required: False
<wavpack>...</wavpack>

Configure libwavpack settings used for enhanced wavpack file analysis.