MP2 Media Database Concept (1 Viewer)

mbuzina

Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Hi Team,

    I have wandered a bit through the wiki and even endevored to look into the code documentation, but I miss one description: Where can I find the information on the media library?

    I am thinking about developing an MP2 plugin that would import (and keep maintained) the picture information from picasa. With this import I would be able to have tags, places & people that picasa adds to the pictures in the MP2 database.

    I think I need to create an PictureImporter (as in the current code) but I would need to add new structure to the picturedb. Some additional question:
    Why does the FileImport Method get a string and not an object describing the file? (I would guess importing a file from inside a CD image inside an archive should be possible, should it not?)

    P.S.: Just starting to look at it, so no final commitment yet. Just thinking as an excercise @ the moment.
     

    tomtom21000

    Retired Team Member
  • Premium Supporter
  • April 22, 2004
    1,226
    120
    Germany
    I'd really like to see this plugin being developed.
    I try to save all picasa tags in the picture ****-data. So, if you will develop this, you might consider to search the pictures **** data for faces/tag information, too. This would also be useful if picasa is on a different pc (picasa stores the information in an .xml as far as I know. So the info is not available at the htpc) or do you only think about pictures uploaded to picasa web-albums?

    Maybe a bit early for feature requests ;)

    tomtom
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    tomtom: yep, a bit early since I am just thinking out aloud. But I am mainly thinking of local picasa (I prefer not to have my pictures along with all people on the web...)

    Picasa stores the names in an xml file and the mapping of person to picture in local picasa.ini files in the same folder as the pictures are. The other data should be in the exif tags, so basically MP should be able to exctract them.
     

    tomtom21000

    Retired Team Member
  • Premium Supporter
  • April 22, 2004
    1,226
    120
    Germany
    @tomtom: yep, a bit early since I am just thinking out aloud. But I am mainly thinking of local picasa (I prefer not to have my pictures along with all people on the web...)

    same here

    Picasa stores the names in an xml file and the mapping of person to picture in local picasa.ini files in the same folder as the pictures are. The other data should be in the exif tags, so basically MP should be able to exctract them.

    my setting is, that I administrate my pics on my desktop pc. for this I use picasa among other software. Later on I transfer these pics to my htpc, where I don't have picasa and therefore no .xml or .ini file from picasa. And if I installed it, the whole process of face recognition would start again on the htpc. So, my solution is to store the picasa face recognition data from the .xml into tags. For this I use this little tool:
    avpicfacexmptagger:main [Andreas Vogel Wiki]

    just for some more information. I guess I am also thinking out loud. Hope you'll get some support soon on your database question.

    tomtom
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    AW: MP2 Media Database Concept

    Hi Team,

    I have wandered a bit through the wiki and even endevored to look into the code documentation, but I miss one description: Where can I find the information on the media library?

    I am thinking about developing an MP2 plugin that would import (and keep maintained) the picture information from picasa. With this import I would be able to have tags, places & people that picasa adds to the pictures in the MP2 database.

    I think I need to create an PictureImporter (as in the current code) but I would need to add new structure to the picturedb. Some additional question:
    Why does the FileImport Method get a string and not an object describing the file? (I would guess importing a file from inside a CD image inside an archive should be possible, should it not?)

    P.S.: Just starting to look at it, so no final commitment yet. Just thinking as an excercise @ the moment.

    Hi,

    first I like your idea and am lucky that you want to do it in MP2 :)

    Some facts about the MediaLibrary:
    • It's a SQL embedded DB, you can access and browse it with a common MS SQL Management studio
    • Information about MediaItems (audio, video, pictures) are stored in so called MediaAspects, one for video details, audio details a.s.o.
    • The information are filled by so called "MetadataExtractors" during:
      • browsing local media navigation (not attached to server)
      • running a importer job by the server that fills the MediaLibrary
    • You do not need to deal directly with the database when you use and extend this technology.
    • You can add more MetadataExtractors that fill MediaAspects, when they are registered, they will be called during import.
    • You could extend existing PictureAspect to hold more attributes, or better: create a new "PicasaPictureAspect" that will be internally persisted as a new database table (MediaLibrary takes care for this!)

    I recently added thumbnails to the MediaAspect (let's call it master data of any MediaItem), look at this commit: https://github.com/MediaPortal/MediaPortal-2/commit/516b997c4f17d142c39dd8cf1f07eb47eff437b4

    So when you plan you plugin check the MetadataExtractors and the MediaAspects first!

    Morpheus
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Re: AW: MP2 Media Database Concept

    Hi,

    first I like your idea and am lucky that you want to do it in MP2 :)

    Some facts about the MediaLibrary:
    • It's a SQL embedded DB, you can access and browse it with a common MS SQL Management studio
    • Information about MediaItems (audio, video, pictures) are stored in so called MediaAspects, one for video details, audio details a.s.o.
    • The information are filled by so called "MetadataExtractors" during:
      • browsing local media navigation (not attached to server)
      • running a importer job by the server that fills the MediaLibrary
    • You do not need to deal directly with the database when you use and extend this technology.
    • You can add more MetadataExtractors that fill MediaAspects, when they are registered, they will be called during import.
    • You could extend existing PictureAspect to hold more attributes, or better: create a new "PicasaPictureAspect" that will be internally persisted as a new database table (MediaLibrary takes care for this!)

    I recently added thumbnails to the MediaAspect (let's call it master data of any MediaItem), look at this commit: https://github.com/MediaPortal/MediaPortal-2/commit/516b997c4f17d142c39dd8cf1f07eb47eff437b4

    So when you plan you plugin check the MetadataExtractors and the MediaAspects first!

    Morpheus

    Hi Morpheus,

    Thanks for the support. I have seen the MetadataExtracors and the PictureImport classes. I wanted to check how a many2many relationship is realized (I have seen that you can just "add" aspects to the database nice, nice work), so I went and looked for MusicImport class (and/or MovieImport) and could not find them. To me it looks like pictures are handled a little different than music (still not fully groked everything of it, I just browsed for 2-3 hours through the code, but still getting to this level of understanding in such a short time does mean it has some proper structure in it).

    If I add aspects (e.g. Person and Many2Many them to pictures, location info and tags) into the database, would MP2 be able to browse by them immediatly (if I setup some views)? If so, great.

    OK, you got me conviced, I will reinstall VS2010 (can I use Express Editions - just saving diskspace ;) )

    @tomtom: I will check if I can extract the XMP Data. I initially wanted just to get at the tags (I think picasa saves them as XMP in the files), but I will check the XMP Person data as well. Or are they saved as XMP tags? Then I would get them, but they would be "normal" tags.
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: MP2 Media Database Concept

    mbuzina, just a short answer.

    In MP2, "media items" are very general everything which is stored in the MediaLibrary. You can create media items for everything you want, they do not need to be of type picture, music or movie. You can store your custom data as media items. To be able to have your own data, you can add media item aspects. That is the description for data records which can dynamically be added to all media items. The default aspects for picture, movie and music are realized in this way, but every plugin can bring in its own aspects.

    See how the existing aspects are defined.
    About your question: Yes, you can have many2many relationships, but you cannot reference a media item from another media item, you can only reference data of simple data types. For example, the artists of the music media item aspect is defined as a many2many attribute.

    Metadata extractors are a way how data can come into the media library; metadata extractors are executed by the importer. There is only one importer class, which does the job of the import, not multiple importers for different types of media. The one and only importer simply traverses over the directories of the shares and executes the metadata extractors.
    But you do not need to create metadata extractors to get metadata into the ML. Metadata extractors are only needed for an automatic import of metadata via the automatic importer, which is made for importing shares and nothing else. If you want to import pictures from the internet, the importer isn't made for that. In that case, you need to have your own import logic which you must schedule by your own.

    I'm not sure how your desired database model looks like. Can you describe what data you want to attach to what? And how do you want to browse it?
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Hi Albert,

    Thanks for your answer. I think I found the right classes - MetaDataExtractor would be right for me, since I want to import picasa information into the MP db and allow browsing by that information.

    I have a attached a crude datamodel (forgive the crows feet, they are handpainted ;) )

    And I would like to setup the following browsing views in "My Pictures":

    Level 1: Person
    Level 2: Pictures sorted by Date Taken

    and
    Level 1: Tag
    Level 2: Pictures sorted by Date Taken
     

    Attachments

    • Datamodel.JPG
      Datamodel.JPG
      14.7 KB

    Users who are viewing this thread

    Top Bottom