MP2 Media Database Concept

Discussion in 'General' started by mbuzina, May 10, 2011.

  1. mbuzina
    • Premium Supporter

    mbuzina Retired Team Member

    Joined:
    April 11, 2005
    Messages:
    2,839
    Likes Received:
    627
    Location:
    Germany
    Ratings:
    +723 / 4
    Home Country:
    Germany Germany
    Show System Specs
    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.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. tomtom21000
    • Premium Supporter

    tomtom21000 Retired Team Member

    Joined:
    April 22, 2004
    Messages:
    1,226
    Likes Received:
    59
    Location:
    Germany
    Ratings:
    +64 / 0
    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
     
  4. mbuzina
    • Premium Supporter

    mbuzina Retired Team Member

    Joined:
    April 11, 2005
    Messages:
    2,839
    Likes Received:
    627
    Location:
    Germany
    Ratings:
    +723 / 4
    Home Country:
    Germany Germany
    Show System Specs
    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.
     
  5. tomtom21000
    • Premium Supporter

    tomtom21000 Retired Team Member

    Joined:
    April 22, 2004
    Messages:
    1,226
    Likes Received:
    59
    Location:
    Germany
    Ratings:
    +64 / 0
    same here

    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
     
  6. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,069
    Likes Received:
    4,762
    Ratings:
    +6,818 / 11
    Home Country:
    Germany Germany
    Show System Specs
    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
     
    • Like Like x 1
  7. mbuzina
    • Premium Supporter

    mbuzina Retired Team Member

    Joined:
    April 11, 2005
    Messages:
    2,839
    Likes Received:
    627
    Location:
    Germany
    Ratings:
    +723 / 4
    Home Country:
    Germany Germany
    Show System Specs
    Re: AW: MP2 Media Database Concept

    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.
     
  8. Albert
    • Premium Supporter

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    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?
     
  9. mbuzina
    • Premium Supporter

    mbuzina Retired Team Member

    Joined:
    April 11, 2005
    Messages:
    2,839
    Likes Received:
    627
    Location:
    Germany
    Ratings:
    +723 / 4
    Home Country:
    Germany Germany
    Show System Specs
    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
     

    Attached Files:

    • Datamodel.JPG
      Datamodel.JPG
      File size:
      14.7 KB
      Uploaded:
      May 12, 2011
      Views:
      164
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!