MediaPortal Windows Media Center
MediaPortal Wiki > MediaPortal 2 > Contribute > Development > Concepts > Metadata system

Metadata system

Was this page helpful?
Redirected from 2 MEDIAPORTAL 2/Contribute/Development/3 Concepts/Metadata system

    Overview

    This sections gives information about media item and metadata management.

    Media item and metadata management

    MediaPortal 2 provides a very flexible media library that contains all information about media items. A media item can be any kind of image, audio or video file, or even a streaming source.


    The metadata for the media items are structured in so called "aspects". The default aspects are:

    • MediaAspect (master data of a media item)
    • ImageAspect (image related information)
    • VideoAspect (video related information)
    • AudioAspect (audio related information)
    • ThumbnailSmallAspect (small thumbnail, used for image and video)
    • ThumbnailLargeAspect (larger thumbnail, used for image and video)

     

    For the full list and source code check https://github.com/MediaPortal/Media...ultItemAspects.


    Aspects can contain inline attributes and many-to-one, one-to-many and many-to-many relations (i.e. artists). There are default aspects which are provided by the base MP2 system, more aspects can be provided by plugins. Each "aspect" is internally stored in a database table. When new aspects are created and registered, the media library automatically creates tables for them.

    Importers and metadata extractors

    When resources are imported, the traversal through the resource tree is executed by the generic importer. To extract metadata from media items, the importer involves so called "Metadata extractors" which can be dynamically added by plugins. Metadata extractors are used to indentifiy media items and read information from them (i.e. MP3 tags, video and audio stream information, image EXIF data...) and are called when you navigate through "Local media navigation" (when not attached to MP2 server) or when a share gets imported into the media library (attached to server).

    Metadata extraction can be an expensive task (as related to runtime and I/O operations), so we provide two different operation modes for metadata extractors:

    • Fast (used in local navigation) - only extracts local metadata which can be extracted fast
    • Extended (used in importer) - can also apply long-term extraction processes like internet requests

    For example, the thumbnail extraction is only done in "extended mode", while in "fast mode" only existing thumbnail from the windows explorer cache.

    Use of metadata inside skins

    Skins can register any additional aspect to be loaded when you are browsing the media library. This means if you implement more aspects and want to show their information inside a skin screen, you simply need to tell the media plugin to query the information from the media library and provide it to the skin. You can define the required metadata on a per-aspecttype-basis:

    For instance refer to the default skin's plugin.xml https://github.com/MediaPortal/Media...ase/plugin.xml:

    <!-- Registrations for MIA types which need to be loaded by the Media navigation model for this skin -->

      <Register Location="/Media/SkinSettings/default/default/Videos/OptionalMIATypes">
        <MIATypeRegistration Id="ThumbnailSmallAspect" MediaItemAspectTypeId="A61846E9-0910-499D-9868-A1FABCE7CCFD"/>
        <MIATypeRegistration Id="ThumbnailLargeAspect" MediaItemAspectTypeId="1FDA5774-9AC5-4873-926C-E84E3C36A966"/>
      </Register>
     
      <Register Location="/Media/SkinSettings/default/default/Images/OptionalMIATypes">
        <MIATypeRegistration Id="ThumbnailSmallAspect" MediaItemAspectTypeId="A61846E9-0910-499D-9868-A1FABCE7CCFD"/>
        <MIATypeRegistration Id="ThumbnailLargeAspect" MediaItemAspectTypeId="1FDA5774-9AC5-4873-926C-E84E3C36A966"/>
      </Register>
     

    The registration can be done separately for each media navigation part (Audio, Images, Videos, BrowseLocalMedia, BrowseMediaLibrary) and for each skin/theme.

    If for example a  new skin "MySkin" should show data from an additional aspect in its theme "Theme1", it can register that like this:

     

      <Register Location="/Media/SkinSettings/MySkin/Theme1/Images/OptionalMIATypes">
        ...
      </Register>
     

    Those registrations are inherited through the skin resource lookup chain, so if you inherit from another skin or theme, you also inherit those registrations.




    Running the latest version?

    V1.7.0 - released April 2014
    Releasenews | Download
    Changelog
     | Requirements
    HTPC
    Team-MediaPortal
     
    About
    Contact |  Press
    Partners