Difference between revisions of "Media Pictures (mediapics)"

From LinuxMCE
Jump to: navigation, search
Line 1: Line 1:
<table width="100%"> <tr><td bgcolor="#FFCFCF">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.</td></tr> </table>== Introduction ==
+
== Introduction ==
  
 
LinuxMCE ''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:
 
LinuxMCE ''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:

Revision as of 09:11, 19 March 2007

Introduction

LinuxMCE 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 LinuxMCE-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 cover art 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>"

The database

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.

MediaPics-database-ver3.png

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.