Appendix: MME Database Schema Reference

This is a reference of the tables and indexes in the MME database.


Note: Tables that begin with an underscore character (_) are not documented here. They are for internal use only.

Tables:

Table diagrams:


MME Schema


The MME Schema.


Note: You can view a larger version of this schema graph here.

Tables in mme

Table: controlcontexts

The controlcontexts table defines MME control contexts. Control contexts define where clients can connect to the MME and control it. Each control context can play one media track at a time, manage its own list of items to play, and output playback to one zone. Control contexts are statically configured and enumerated at startup time.

Primary key: ccid

Fields:

Field Description Type Default Nulls? References
ccid The control context ID. Integer yes
trksessionid The ID of the tracksession that is being used on the control context. Integer 0 no trksessions
zoneid The ID of the zone to which the control context is outputting playback. Integer 0 no zones
rendid The ID of the renderer that this control context should use. Integer no renderers
name The name of the control context. This name will appear as /dev/mme/name Text, unique no

Table: renderers

The renderers table defines the io-media instances that exist in the system, and the capabilities of these io-media instances. A control context uses the specified io-media to decoding and encode work.

Primary key: rendid

Fields:

Field Description Type Default Nulls? References
rendid The ID of the renderer instance. Integer yes
available The renderer availability. Set to 1 if this renderer can be used, 0 if it can't be used. Integer 1 no
permanent Permanent renderers may not be removed. Integer 1 no
path The path to the renderer. For example: /net/node/dev/io-media. Text no

Table: zones

The zones table defines the MME zones. The output devices associated with a zone are listed in the zoneoutputs table.

Primary key: zoneid

Fields:

Field Description Type Default Nulls? References
zoneid The ID of the zone Integer yes
name The name of the zone Text, unique no

Table: zoneoutputs

The zoneoutputs table lists the output devices that are associated with each zone. Each zoneid can have multiple rows to support multiple output devices.

No primary key.

Fields:

Field Description Type Default Nulls? References
zoneid The ID of the zone. Integer no zones
outputdeviceid The IDs of the output devices in the zone. Integer no outputdevices

Table: outputdevices

The outputdevices table lists known output devices. Output devices define where media can be sent. An output device could be a GF layer, an io-audio PCM name, a Bluetooth headset, etc.

Primary key: outputdeviceid

Fields:

Field Description Type Default Nulls? References
outputdeviceid The ID of the output device. Integer yes
type The type of device, as defined by the enumerated type mme_outputtype_t values: OUTPUTTYPE_*. Integer 0 no
available The availability of the output device. Set to 1 for available. Integer 1 no
permanent The device permanency. Set to 1 to make the device permanent and forbid its removal. Integer no
name The name of the device. This name can be shared with end users. Text no
devicepath The location of the output device, used to connect to the output device. This path is not shared with end users. Text no

Table: slots

The slots table lists the slots known to the MME. Slots define the physical locations where the MME looks for new mediastores. The default setup assumes two USB mass storage devices, one CD/DVD drive, and the hard drive. You may wish to customize where the location of the hard drive. In addition, if you add control contexts and they have their own slots, you must add them to this table. Note that the local control context's hard drive must be the first entry in the table, with msid = 1.

Primary key: slotid

Fields:

Field Description Type Default Nulls? References
slotid The ID for the slot. Integer yes
active Indicates whether the slot is active (available), or unavailable:
  • 1 = active
Integer 0 no
msid The ID of the mediastore associated with this slot. Integer 0 no mediastores
multimsid Integer 0 no
slottype The type of slot. These correspond to the MME_SLOTTYPE_* types defined in <mme/interface.h>:
  • 0 = standard
  • 1 = USB
  • 2 = CD/DVD
  • 3 = harddrive
  • 4 = media file system (io-fs)
Integer 0 no
zoneid The ID of the zone associated with this slot. Integer no zones
max_lib_entries The maximum number of library table entries an active media store in this slot is permitted to use. A value of 0 means there is no limit enforced. Integer 0 no
delete_at_start If non-zero, mediastores that were listed as active at shutdown in this slot are deleted instead of being set to unvavailable. Integer 0 no
path The filesystem path to this slot. Text no
name The slot name. This name is used as the default for mediastores without names. Text NULL yes

Indices:

Index name Fields
slots_msid_index msid

Table: languages

The languages table defines strings that your application can use for multi-language support.

Primary key: language_id

Fields:

Field Description Type Default Nulls? References
language_id The language ID. Integer yes
active Indicates whether this is the active (current) language.
  • 1 = active
Integer 0 no
lang_code The 2-character ISO639-1 language code. Text no
language The language name. Text no
unknown String for "unknown". Text yes
unknown_artist String for "unknown artist" Text yes
unknown_album String for "unknown album" Text yes
unknown_genre String for "unknown genre" Text yes
unknown_category String for "unknown category" Text yes
unknown_composer String for "unknown composer" Text yes
synchronizing String for "synchronizing" Text yes
unknown_language Text yes
unknown_conductor Text yes
unknown_soloist Text yes
unknown_ensemble Text yes
unknown_opus Text yes
unknown_track String for building unknown title of CDDA and DVD-Audio tracks Text NULL yes
unknown_chapter String for building unknown title of DVD-Video tracks Text NULL yes
unknown_title String for building unknown title of DVD-Video tracks Text NULL yes
unknown_group String for building unknown title of DVD-Audio tracks Text NULL yes

Table: mediastores

The mediastores table lists the mediastores known to the MME. A mediastore is a collection of media tracks and/or files that the MME can access and play. Where a slot is the physical location of some media (for example, a CDROM drive), a mediastore represents the media itself (for example, a CD).

Mediastores are managed by the MME, so you don't need to customize this table.

Primary key: msid

Fields:

Field Description Type Default Nulls? References
msid The mediastore ID. Integer yes
slotid The ID of the physical slot associated with this mediastore. Integer 0 no slots
available Indicates whether the mediastore is available:
  • 0 = not available,
  • 1 = available
Integer 0 no
storage_type The storage type, which corresponds to the MME_STORAGETYPE_* types defined in <mme/interface.h>. Integer 0 no
trksessionid The last tracksession that was saved on this mediastore. Integer 0 no trksessions
lastseen The last time the mediastore was seen by the MME. If there is no RTC in the system, this value will increment each time the mediastore is seen, but it will not show the true time. Integer 0 no
capabilities The capabilities of this mediastore (for example, can it be explored or synchronized?). These capabilities correspond to the MME_MSCAP_* type defined in <mme/interface.h>. Integer 0 no
active Indicates if a mediastore is active, or if a slot change is required. A mediastore can not be active if it is not available:
  • 0 = not active,
  • 1 = active (i.e. currently active slot in a changer)
Integer 0 no
location The location of the device where the mediastore is currently inserted:
  • empty = not currently inserted in a slot, or is in a device for which location has no meaning
  • non-empty = location string that has meaning only to the device (devices that only support one location will always be set to empty)
Text yes
syncflags Indicates which synchronizations have been completed on the mediastore:
  • 0 = none (not synchronized)
  • 1 = pass 1 (files)
  • 2 = pass 2 (metadata)
  • 4 = pass 3 (playlists)
  • others to be determined
Integer 0 no
concurrency Indicates how many concurrent readers are supported by the mediastore: 1=“one reader”, 2=“two readers”, etc. Integer 1 no
supported Indicates if the device is supported:
  • 0 = not supported
  • 1 = supported
Integer 1 no
last_sync The time (in nanoseconds from the reference) of the last synchronization attempt of any time on the mediastore. Integer 0 no
metadatapluginid The metadataplugin that was used to sync the mediastore. 0 means not specified. Integer 0 no metadataplugins
mssname Internal use only. The MSS plugin that handles this mediastore. Text no
name The name of the mediastore (for example, “memory stick”. This field may be null if the mediastore name cannot be determined. Text NULL yes
identifier A unique identifier, such as the FAT serial number. Set to NULL to flag the mediastore as invalid and ready to be deleted in the background. Text yes
driver_identifier A unique identifier, as provided by the device driver. Text yes
mountpath The mounted path of the mediastore. Text no

Indices:

Index name Fields
mediastores_identifier_index identifier
mediastores_driver_identifier_index driver_identifier
mediastores_active_index active

Table: metadataplugins

The metadataplugins table lists the metadata syncronizers known to the MME.

Primary key: metadatapluginid

Fields:

Field Description Type Default Nulls? References
metadatapluginid The metadata plugin ID. Integer yes
name The name of the metadata plugin. Text no

Table: playlists

The playlists table holds playlists that your application can convert into track sessions and play. A playlist is a collection of media tracks. Each playlist is defined by an SQL statement that queries the library for tracks that meet some criteria. Alternately, the SQL statement may query the playlistdata table, which can contain an arbitrary selection of tracks, grouped by a matching playlist ID.

Primary key: plid

Fields:

Field Description Type Default Nulls? References
plid The playlist ID. Integer yes
ownership Indicates who owns this playlist:
  • 0 = owned by the MME
  • 1 = owned by the device
  • 2 = owned by the user
Integer 0 no
folderid The ID of the folder that the playlist is in. Integer 0 no folders
msid A link to a mediastore. If this playlist belongs to more than one mediastore, then this msid is 0. Integer 0 no mediastores
mode The playlist mode:
  • 0 = library mode
  • 1 = generated mode
Integer 0 no
seen Indicates that the file was seen during the latest synchronization. This field is set to 0 at the beginning of a synchronization, then set to 1 when the file is found. Integer 1 no
date_modified The date this playlist was last modified. Integer 0 no
accurate If this field is set to 1, the playlist is accurate. Integer 0 no
last_sync The time (in nanoseconds from the reference) of the last playlist (pass 3) synchronization attempt for the playlist. Integer 0 no
size The size of the playlist file on the device. Integer 0 no
signature md5 hash of the playlist. Text '0' no
filename If the playlist points to a device, the filename of the playlist on the device. This name is a path relative to the basepath of the folder. Text '' no
name The playlist name. Text no
statement An SQL statement that returns a list of file IDs (fids), either from the library table, or from the playlistdata table. Text yes
seed_data Used by playlist generators (i.e. mode = 1) Text yes

Table: trksessions

The trksessions table stores track sessions, which are lists of file IDs(fids) that the MME can access and play. A track session can be generated by using a playlist, or by any query to the library table that results in a list of file IDs (selecting all tracks by an artist, for example).


Caution: Your application shouldn't write to this table directly. It can create track sessions by calling the mme_newtrksession() function.

The fields in the trksessions table should only be accessed through MME function calls. The MME may cache some of the values in this table, so if the client application reads this table directly it may have incorrect data.


Primary key: trksessionid

Fields:

Field Description Type Default Nulls? References
trksessionid Integer yes
track_offset Internal use only. Integer 0 no
saved_offset The saved fid used to resume the trksession (0 = not saved). Integer 0 no
savedposition The saved position in a fid/bid that can be used for resuming playback. BLOB 0 no
mode The track session mode:
  • 0 = library mode
Integer 0 no
random Integer 0 no
repeat Integer 0 no
tvcomplete Indicates if the track view was finished loading:
  • 0 = no
  • 1 = yes
Integer 0 no
statement The SQL statement that results in a list of file IDs that the track session plays. Text no

Table: encodeformats

The encodeformats table defines encode formats that can be used by the MME. Note that codecs that support multiple mime types or multiple bitrates will have separate entries in this table.

Primary key: encodeformatid

Fields:

Field Description Type Default Nulls? References
encodeformatid The endcode format ID. Integer yes
bitrate The bitrate to encode at, in kilobytes. Integer 0 yes
name The name for the encode format. Text, unique no
mime The mime type to use. Text no
extension The output file extension. Text yes

Table: copyqueue

The copyqueue table is a queue of files to copy from one mediastore to another. While the files are being copied, they may also be encoded (“ripped”). If the files are encoded, the encode format is defined by the encodeformats table.

Primary key: cqid

Fields:

Field Description Type Default Nulls? References
cqid Copy queue ID. Integer yes
srcfid The ID of the source file to copy. Integer no
srcmsid The ID of the source mediastore. Integer no
destmsid The ID of the destination mediastore. Integer no
copyflags Copy flags supplied by user Integer 0 no
copyattempts The number of failed copy attempts to make before removing the item from the copy queue. Integer 0 no
encodeformatid The encode format to use for the copy. Integer 1 no encodeformats
destfolder The destination folder basepath name, in the format /xxxxxx/. Text yes
destfilename The destination filename. Don't add the extension. If this field is NULL, the MME will create a name. Text yes
unknown_album Metadata used to replace unknown album (if nonaccurate) Text yes
unknown_artist Metadata used to replace unknown artist (if nonaccurate) Text yes

Table: bookmarks

The bookmarks table contains information about all bookmarks for file IDs.

Primary key: bookmarkid

Fields:

Field Description Type Default Nulls? References
bookmarkid The bookmark ID. Integer yes
fid The file ID of the bookmarked track. Integer yes library
msid The mediastore ID for the mediastore with the bookmarked file. Integer yes mediastores
name A name for the bookmark, specified with mme_bookmark_create(). Text yes
data Data used for resuming playback at the proper location. Internal use only. BLOB no

Indices:

Index name Fields
bookmarks_index_fid fid
bookmarks_index_msid msid

Table: trksessionview

The trksessionview table contains a snapshot of the current track session. All its fields are updated by the functions mme_settrksession() and mme_trksessionview_update().

Primary key: sequentialid

Fields:

Field Description Type Default Nulls? References
sequentialid The track file IDs (fid) in sequential order, based on the results of the ORDER BY clauses in the SQL statement used to create the track session. Integer yes
fid The file ID of the track. Integer no
trksessionid The track session ID. Integer no
randomid The track file IDs (fid), in pseudo-random order. If random mode is turned on for the control context, the MME will play tracks in the order they appear in this field. Integer yes

Indices:

Index name Fields
trksessionview_index_random trksessionid, randomid
trksessionview_index_seq trksessionid, sequentialid

Table: copy_incomplete

Primary key: fid

Fields:

Field Description Type Default Nulls? References
fid Integer yes

Table: mdi_image_cache

The imagecache table contains a list of all image files stored in the persistent cache.

Primary key: insertion_sequence

Fields:

Field Description Type Default Nulls? References
insertion_sequence An id that keeps track of insertion order. Integer yes
msid The MSID the source image file was from. Integer no
fid The file ID of the track. Integer no
image_index The image index of a given track Integer no
profile_index The profile index for a converted image. -1 not converted. Integer no
size The size in bytes of the given index. Integer no
hit_count The number of cache hits for this entry. Integer no
hit_sequence A sequence number that indicates the last hit file. Integer no
file The relative path to the file within the cache. Text no

Table: ext_db_sync_state

The ext_db_sync_state table contains persistent state information for all extern DBs that must stay in sync with the MME database.

No primary key.

Fields:

Field Description Type Default Nulls? References
unique_db_id Text no
msid The MSID that corresponds to the state. Integer no mediastores
data The state data of the external DB BLOB no

Tables in mme_library

Table: folders

The folders table stores the path of files found on mediastores and can be used to hierarchically find folders.

Primary key: folderid

Fields:

Field Description Type Default Nulls? References
folderid The folder ID for the folder. Integer yes
msid The mediastore to which the folder belongs. Integer yes mediastores
parentid The parent folder for this folder. Set to 0 if there is no parent folder. Integer 0 no
synced If this field is set to 1, the folder has been synchronized during the first synchronization pass. Integer 0 no
seen A flag to indicate if the folder was seen or not seen during synchronization. Integer 1 no
filecount The number of files in the folder. Integer 0 no
playlistcount The number of playlists in the folder. Integer 0 no
foldercount The number of subfolders in the folder. Integer 0 no
foldersize The size of the folder, in bytes. Integer 0 no
last_sync Reserved for the time (in nanoseconds from the reference) of the last synchronization attempt on the mediastore. Integer 0 no
foldername The name of the folder (for example, Rolling Stones). Text no
basepath The full path of the folder (for example, Music/Rolling Stones). Text no
hash For internal use only. BLOB yes
collisions For internal use only. BLOB yes
collision_names For internal use only. BLOB yes

Table: library

The library table defines the media library used by the MME. Each entry in this table is a media track, which you can use to build track sessions and playlists.

The library is managed by the MME, so you don't need to customize it.

Primary key: fid

Fields:

Field Description Type Default Nulls? References
fid The file ID (fid) for the media track. Integer yes
msid The mediastore that this track is stored on. Integer 0 no mediastores
folderid The path in the mediastore where the track is located. Integer 0 no folders
ftype The type of the media track, which corresponds to the FTYPE_* types defined in <mme/meinterface.h>:
  • 0 = unknown
  • 1 = audio
  • 2 = video
  • 3 = audio and video
  • 4 = photo
Integer 0 no
accurate Indicates if the metadata for the track is known to be accurate. Integer 0 no
last_sync The time (in nanoseconds from the reference) of the last metadata synchronization attempt for the track. Integer 0 no
seen Indicates that the track has been identified on the mediastore. Integer 1 no
artist_id The ID of the track artist. Integer 1 no library_artists
album_id The ID of the track album. Integer 1 no library_albums
genre_id The ID of the track genre. Integer 1 no library_genres
year The year of the track. Integer 0 no
size The size of the track, in bytes. Integer 0 no
category_id The ID of the track category. Integer 1 no library_categories
composer_id The ID of the track composer. Integer 1 no library_composers
discnum The disc number of the content. This field is useful for box sets. Integer 0 no
titlenum The title/group number of the CDDA/DVDV/DVDA. Integer 0 no
tracknum The track/chapter number of the CDDA/DVDV/DVDA. Integer 0 no
rating The rating (0 = unkown, 1 = worst, 255 = best). Format specific rating is scaled to 1 - 255 range, for example, 1 stars = 60, 2 starts = 125, ..., 5 starts = 255) Integer 0 no
date_added The date the track entry was added to the library table. Integer 0 no
date_modified The date the track entry was modified in the library table. Integer 0 no
bitrate The track bitrate. Integer 0 no
audio_index The audio index of the track on the DVD. Integer 0 no
format The format of the track, as defined by the MME_FORMAT_* values. Integer 0 no
num_channels The number of audio channels on the track. Integer 0 no
language_id The ID of the track language. Integer 1 no library_languages
samplerate The sampling rate, in hertz, of the audio stream. Integer 0 no
conductor_id The ID of the track conductor. Integer 1 no library_conductors
soloist_id The ID of the track soloist. Integer 1 no library_soloists
ensemble_id The ID of the track ensemble. Integer 1 no library_ensembles
opus_id The ID of the track opus. Integer 1 no library_opus
protected Indicates if there is DRM on the track Integer 0 no
last_played The date this track was last played by the MME. Integer 0 no
fullplay_count The number of times this track has been played by the MME. Integer 0 no
duration The track length, in milliseconds. Integer 0 no
copied_fid The file ID of the copied file. This field is 0 if the file has not been copied. Integer 0 no
playable Indicates if the track is playable. Integer 1 no
permanent If this field is set to 1, the file cannot be pruned. Integer 0 no
description An arbitrary text description of the track. Text '' no
title The track title. Text NULL yes
filename The file name of the media track. Text '' no

Table: library_genres

Primary key: genre_id

Fields:

Field Description Type Default Nulls? References
genre_id Integer yes
genre Text, unique yes

Table: library_artists

Primary key: artist_id

Fields:

Field Description Type Default Nulls? References
artist_id Integer yes
artist Text, unique yes

Table: library_albums

Primary key: album_id

Fields:

Field Description Type Default Nulls? References
album_id Integer yes
album Text, unique yes

Table: library_composers

Primary key: composer_id

Fields:

Field Description Type Default Nulls? References
composer_id Integer yes
composer Text, unique yes

Table: library_conductors

Primary key: conductor_id

Fields:

Field Description Type Default Nulls? References
conductor_id Integer yes
conductor Text, unique yes

Table: library_soloists

Primary key: soloist_id

Fields:

Field Description Type Default Nulls? References
soloist_id Integer yes
soloist Text, unique yes

Table: library_ensembles

Primary key: ensemble_id

Fields:

Field Description Type Default Nulls? References
ensemble_id Integer yes
ensemble Text, unique yes

Table: library_opus

Primary key: opus_id

Fields:

Field Description Type Default Nulls? References
opus_id Integer yes
opus Text, unique yes

Table: library_categories

Primary key: category_id

Fields:

Field Description Type Default Nulls? References
category_id Integer yes
category Text, unique yes

Table: library_languages

Primary key: language_id

Fields:

Field Description Type Default Nulls? References
language_id Integer yes
language Text, unique yes

Table: db_sync

The db_sync table is used by the generic handler for external database synchronization plugins. It should be considered private to the MME.

No primary key.

Fields:

Field Description Type Default Nulls? References
msid The ID of the media store that the library table entry is on. Integer no mediastores
fid The ID of a library table entry that synchronizers have been told about. (fid). Integer no library
last_sync The internal timestamp value when the external database synchronizers were last told about this file. Integer 0 no

Table: playlistdata

The playlistdata table is available for storing any linear created playlists. They can be selected using the “statement” from the playlists table.

Primary key: oid

Fields:

Field Description Type Default Nulls? References
oid An order identifier. This can be used to assign an arbitrary order to the playlist using the SQL ORDER BY clause. Integer yes
plid The ID of the playlist to which this track belongs. Integer no playlists
fid The track file ID (fid). Integer no library
msid The ID of the mediastore. Integer no mediastores

Indices:

Index name Fields
library_index_folderid_msid_filename folderid,msid,filename
folders_index_parentid parentid

Tables in mme_temp

Table: nowplaying

The nowplaying table holds information about the currently playing or last played track for a control context. This information is maintained by the MME: your client application can query it this table, but shouldn't write to it. You can query this table when your client receives a MME_EVENT_TRACKCHANGE event indicating that a new track is playing. The information may be limited by the metadata available, so some fields may not contain data for every track.


Note: The MME doesn't clear this table after a track stops playing, so if there's no playing track, it contains information about the last played track.

Primary key: ccid

Fields:

Field Description Type Default Nulls? References
ccid The ID for the control context where the track is currently playing. Integer yes controlcontexts
playing Reserved for future use. Integer 0 no
fid The file ID (fid) for the track (0 if unknown). Integer 0 no library
msid The ID of the mediastore with the track. Integer 0 no mediastores
ftype The track's file type. See the ftype field in the library table. Integer 0 no
year The track's year. Integer 0 no
bitrate The track's bitrate, in bytes per second. Integer 0 no
samplerate The track's samplerate, in hertz. Integer 0 no
num_channels The track's number of channels: 1=mono, 2=stereo. Integer 0 no
size The track's size, in bytes. Integer 0 no
discnum The track's disc number. Integer 0 no
tracknum If the track is part of a collection (i.e. an album), the track's Integer 0 no
rating The rating (0 = unkown, 1 = worst, 255 = best). number in the collection. Integer 0 no
copied_fid The file ID for the copied file, placed in the library table by media copy and ripping operations. Integer 0 no
filename The filename of the track (empty string if unknown). Text '' no
artist The track's artist. Text '' yes
title The track's title. Text '' yes
album The track's album. Text '' yes
genre The track's genre. Text '' yes
composer The track's composer. Text '' yes
conductor The track's conductor. Text '' yes
soloist The track's soloist. Text '' yes
ensemble The track's ensemble. Text '' yes
opus The track's opus. Text '' yes
category The track's category. Text '' yes
description The track's description. Text '' yes

Tables in mme_custom

Table: mediastores_custom

The mediastores_extra table is an optional extension to the mediastores table. It should have an msid column so that it can be joined with the library table where msid=msid. You should create triggers so that when a row is added to or removed from the mediastores table it is also added to or removed from this table.

Primary key: msid

Fields:

Field Description Type Default Nulls? References
msid The mediastore ID. Integer yes

Table: library_custom

The library_custom table is an optional extension to the library table. It should have an fid column so that it can be joined with the library table where fid=fid, adding this table's columns to the main library table. Some examples of columns that could be added to the library_custom table are rating and skip_count. However, any user-defined columns can be added to this table. You should create triggers so that when a row is added to or removed from the library table it is also added to or removed from this table.

Primary key: fid

Fields:

Field Description Type Default Nulls? References
fid The file ID. Integer yes

Table: playlistdata_custom

The playlistdata_custom table is an sample table placed here to support application created playlists. It has the same fields as the playlistdata table. See the description of the playlistdata table for information about this table and how it can be used.

Primary key: oid

Fields:

Field Description Type Default Nulls? References
plid The playlist ID. Integer no playlists
fid The file ID. Integer no library
msid The mediastore ID. Integer no mediastores
oid The order identifier. Integer yes