Component:Medialib - nesciens/xmms2-wiki GitHub Wiki
The Medialib (media library) is where XMMS2 stores metadata about files as it plays them. It is implemented using an sqlite database, so queries and data updates are all performed using standard SQL queries. For examples of what the Medialib may look like, please try existing media players that implement a similar feature - these are listed on the Wikipedia article Comparison of media players. (Note the 'Media Database' column of the 'Features' table)
Notes
This component is pending changes and may be merged with the playlist component.
The new design should be something like this
create table Media (MID, KEY, VALUE);
create table Log (MID, STARTTIME, STOPTIME, VALUE);
This means all values are flat in the media table.
We should also have some kind of grouping. Like this:
create table groups (type, name, key, id);
create table groupmembers (id, mid);
create table groupproperties (id, key, value);
Where a grouptype could be a album, artist, playlist, whatever.
Compilation thoughts
Clients should display complations / VA albums nicely instead of cludged under each artist. We should have a flag in medialib if a entry is a part of a compilation or not. This should be read from id3/vorbiscomment if available (don't count on it) and we should have an alternative detection mode. My suggestion is something like this:
- Either we can set a path in the configuration where albums should be treated as va. ie. xmms2 config medialib.va_album_path=/music/Compilations;/music/Soundtracks, files under this directory will have the XMMS_MEDIALIB_ENTRY_PROPERTY_COMPLILATION set to 1.
- Or we do something more funky where we in the reader thread keep track of albums and match COMPILATION=1 if the artist on the albums track are different. This could be a problem if you don't add all the tracks on the album at the same time, also if different albums are named the same, how do we handle that?
Indexthread (mediainfo reader)
How it works
playlist calls medialib_entry_new() which will add a entry with the resolved=0 and wake the readerqueue. The reader will do the following:
- while(select url from Media where resolved = 0 limit 1)
- for each file check the lmod just like above
- if transport_open() fails it should remove the entry from the lib
- index the file
- update resolved flag
when we rehash we set the entries we want to rehash resolved flag to 0 and wake the readerqueue.