Configuration file

The libmd configuration file lists the preferential plugin order, the library files implementing the plugins, and other configuration settings.

The libmd library is shipped with a default configuration file. You can modify this included file or create your own. You can also override the default path that the library looks in for the configuration file, when calling mmmd_init(). If you pass in a configuration path of NULL, the library searches the path given in the MM_MD_CONFIG environment variable or if this variable isn't defined, the default path of /etc/mm/mm-md.conf.

Note: Redefining MM_MD_CONFIG lets you use a different configuration file as the default. This is useful when launching applications such as mm-sync that use libmd but don't allow you to set the configuration path.

In any configuration file, each section that defines settings for an individual plugin (or MDP) must begin with a line like this:

[plugin]

The settings are listed on the lines that follow, one per line. A setting is specified by stating a field name, followed by an equal sign (=), followed by the field value. For example, the following line enables "lazy load filters" for MMF:

lazyloadfilters=1

You can add comments in the file by starting lines with the number sign (#).

A dll setting is required in every plugin section. This setting names the library file implementing the MDP plugin. To support a good user experience, your configuration file should define at least all the MDPs needed to extract any metadata field used by your client applications. Most likely, you'll have to provide more than one plugin section in your configuration because most MDPs don't support every metadata field.

The section defining the preferential plugin order begins with a line of the form:

[typeratings]

The lines that follow list the MDP preferences for specific file types. Each line contains a URL prefix that represents a file type, followed by the MDPs to use for metadata extraction, from most to least preferred. Suppose you want to inform libmd of your plugin preferences for POSIX files, whose URLs have either a file prefix or no prefix at all. If you want to use the MMF MDP first, then the Exif MDP if some metadata fields can't be retrieved by this first MDP, and then the Img MDP if some fields still can't be retrieved, enter the following line:

file=mmf,exif,img

Default configuration file

The contents of the default configuration file look like this:

# libmd config file

[plugin]
dll=mm-mdp-mmf.so
lazyloadfilters=1

[plugin]
dll=mm-mdp-cdda.so

#[plugin]
#dll=mm-mdp-exif.so

#[plugin]
#dll=mm-mdp-img.so

#[plugin]
#dll=mm-mdp-ipod.so

#[plugin]
#dll=mm-mdp-extart.so
#ignore_case=true
#max_search=100
#max_cache_entries=0

# All regular expressions following the first instance must have
# a unique suffix appended to them (e.g., regex, regex1, regex2).
#regex=album\.jp[e]?g
#regex1=folder\.jp[e]?g

#[plugin]
#dll=mm-mdp-mediafs.so

[typeratings]
file=mmf
#file=mmf,exif,img
http=mmf
cdda=cdda
rtsp=mmf
#ipod=ipod
#mtp=mediafs
Note: Some MDP settings are commented out in the default file; to enable any of these settings, simply uncomment its line.

MDP Settings

You can configure these MDP settings to further control metadata extraction:

MDP Setting Description
Extart ignore_case Use case-insensitive matching of filenames; this is usually desired
max_cache_entries Limit the number of folders cached after searching; this helps limit memory usage
max_search Limit the number of files to check in a folder when looking for external artwork. Defining this setting lets you keep the search time within a reasonable limit. For example, if a folder contains 10 000 files but max_search is 100, only the first 100 files will be checked for artwork.
regex[#] Define POSIX regular expression (regex) patterns for matching names of artwork files. You can define multiple fields; the first can be named regex but the remaining fields must contain unique suffixes (e.g., regex1, regex2).
MMF lazyloadfilters Don't initialize MMF until the first request for metadata; this saves on startup time