Media Pictures (mediapics)
|This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.|
Pluto media pictures are the picture files associated to media files (mp3, mov, dvd). There are three ways to associate a picture to a media file:
1. Use pluto-admin, Files & Media > Media Files Sync a choose a media file. You can upload a picture and associate it with a media file or choose an attribute of one or more media files and set a picture file for it/them.
2. When you rip a dvd and using CDDB, the coverart of the dvd is automatically downloaded and associated with the stored dvd file. Same thing when you only play a dvd.
3. Use UpdateMedia daemon which indexes the media files for the media folders and eventually downloads the image for a mp3 or any file which has id3 tags.
The media pictures are stored on /home/mediapics. The are two picture files created : the cover art "/home/mediapics/<picture_id>.<ext>" and the thumbnail "/home/mediapics/<picture_id>_tn.<ext>"
In the database schema from the following picture, you can see that you can associate a picture to a file and one picture for each of the file's attributes.
The filegrid from Orbiter is populated using File_Grid_Plugin's FileListGrid::ToData method. The way the pictures are shown in Orbiter is:
a. if the file has a picture associated, that picture will be shown
b. if no picture is associated directly to the file, FileListGrid will look over file's attribute and display the picture which of the attributes with the type having the minimum PicPriority.
Orbiter and how it gets the pictures
For filegrid for music, movies and videos, Orbiter sends a "Populate datagrid" command to Datagrid_Plugin which routes the command to "File_Grid_Plugin" which has the datagrid generator "File_Grids_Plugin::FileList" method registered for DATAGRID_Directory_Listing_CONST datagrid. Then Orbiter send a "Request Datagrid Contents" command to Datagrid_Plugin which will call FileListGrid::ToData.
By default, USE_PRECACHED_DATABASE_MAP is defined in FileListGrid. This will activate the code which gets the right picture for each file from the specified folder, using the database. If is done using a single sql query and the data will be pre-cached and used for each file.
If USE_PRECACHED_DATABASE_MAP is not defined, the picture for each file will be retrieved from the id3 tags for each files. The profiling performed on this code shown that using pre-cached database data is faster the using id3 tags in this case.