The <Configuration>/<Database>/<Synchronization>/<ConfigurableMetadata> element

The <Configuration>/<Database>/<Synchronization>/<ConfigurableMetadata> element configures metadata support. This element specifies how metadata string length is restricted and contains <metadata> elements that configure the mapping between fields read from the metadata provider and fields written to database tables, along with other parameters.

Table 1. Contents of <Configuration>/<Database>/<Synchronization>/<ConfigurableMetadata> element
Nested element Attribute Description
<maximum> type Specifies the unit used for the maximum lengths of metadata strings, either characters or bytes. For UTF-8 strings, which are multibyte-encoded, this setting can greatly affect how many visible characters are returned. The default setting is characters.
<metadata> ftype Declares the media type for the metadata. Acceptable values are audio, video, and photo.
<metadata> table Names the database field that stores the metadata that you want to synchronize. The table name is listed first, followed by a dot (.), then the field name. For example, a table setting of video_metadata.width tells mm-sync that it must store the metadata in the width field (column) of the video_metadata table.
<metadata> ext_table

(Optional)

Identifies the table and column that stores the values for this bit of metadata. This table is considered external because it's separate from the main metadata table. For instance, an ext_table setting of artists.artist instructs mm-sync to store the metadata value (the artist name) in the artist column of the artists table.

When you define this attribute, you must also define ext_table_rel.

<metadata> ext_table_rel

(Optional)

Identifies the field that relates external table entries to main table entries. With the above example for ext_table, an ext_table_rel setting of artists.artist_id instructs mm-sync to store the artist_id field in the main table, and the artist name in the external table entry with the matching artist_id.

When you define this attribute, you must also define ext_table.

<metadata> md_map

Names the metadata provider fields to synchronize to the database. The metadata provider name is listed first, followed by the AT sign (@), then a comma-separated list of applicable field names. Details for different metadata providers must be separated by a semicolon.

Consider this example:

libmd@artist,albumartist;ipod@artist;

This setting tells mm-sync that the current mapping applies to the artist and albumartist fields from the libmd metadata provider and the artist field from the ipod metadata provider. Note that metadata is matched in left-to-right order. So in this example, the artist field will be used from the libmd provider, not from ipod.

<metadata> maximum

(Optional)

Limits the length of the metadata string that mm-sync writes into the field named by table. The length unit (either bytes or characters) is defined by the <maximum> tag in the parent element. By default, the length limit is 256 characters.

Storing metadata values in external tables

For metadata fields with values repeated for many media files, such as artist or genre, you can save space and improve performance by storing those field values in an external table and using an index in the main table to refer to specific values.

Suppose a mediastore contains several tracks with an artist setting of “Jamiroquai”. Instead of replicating this string in many metadata table rows, you can store a single copy of the artist name with its associated index in an external table and store the index in all table entries representing tracks by “Jamiroquai”. Storing indexes instead of strings reduces the size of table rows and allows you to sort the metadata faster because index comparisons are considerably faster than string comparisons.

For an individual media file, you can find its setting for any metadata field whose values are stored in an external table by joining the main table with the external table on the field named by ext_table_rel. Suppose you have an external table genres for storing the names of musical genres and a field genre_id for relating the external table entries to the audio_metadata table entries. If you want to list all tracks for a given genre, say “Pop”, you can join these two tables on the genre_id field and filter the results based on the genre name “Pop”.