Plugin Development Questions (Database Related) (1 Viewer)

Melloware

Portal Pro
October 26, 2007
83
1
Home Country
United States of America United States of America
I plan on developing a MediaPortal plugin but I have some questions first... I have scoured the WIKI and found bits of information here and there but I have some questions regarding plugin development.

1. What database is used by MediaPortal? SQLLite? SQLServer? Custom? I have seen mention of all 3 in these forums and I am quite confused on where data is actually stored?

2. I have seen reference to SQLLite in this import and call...

Imports MediaPortal.Music.Database

Dim results As SQLite.NET.SQLiteResultSet

So it is SQLLite?

3. Is there a Database SCHEMA somewhere? I would like to see everything available to query in the database.

4. Is Music and Videos stored in two separate databases or all in the same SQLite database?

5. Should I be developing against MP1 or MP2?

6. Can I build a closed source plugin that is commercially licensed and for profit or does that violate MP agreements in any way?


Thank you in advance for any guidance you can provide!
 

SilentException

Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    1. You choose what type of database to use. If you're developing TVServer plugin, chances are you're gonna use SQL server already used by TVService (MySQL or MS SQL). For MediaPortal plugin, SQLite is commonly used. It would be best for you to check out sources of existing highly used plug-ins like MP-TVSeries or MovingPictures or FanartHandler.

    2. See above :)

    3. Nope AFAIK, but you can use tools like SQLiteSpy [Delphi Inspiration] to help you understand and browse existing databases (as well as their schemes).

    4. Separate. See directory in users folder All Users\Application Data\Team MediaPortal\MediaPortal\database

    5. Depends :) Perhaps both. Smart thing would be to layer the plugin so that the back end could be reused in MP2. Then, only GUI part will have to be rewritten.

    6. Not sure, perhaps someone else will be smarter to answer this :) If I had to guess, I would say no.
     

    Melloware

    Portal Pro
    October 26, 2007
    83
    1
    Home Country
    United States of America United States of America
    Thanks for your responses!

    As for my plugin it would be music related mostly.

    So when you install MediaPortal it does not install a Music database by default with a schema? Every plugin creates their own DB?

    I figured there would be some preconfigured ARTIST, ALBUM, TRACK,GENRE tables with common ways to access them all as well as query. I guess I need to look at some existing music-based plugins to figure out how they work. Any recommendations on that?
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    I'm not sure (I haven't done fresh install in a year) but I think that after installation, database is already there. But ofcourse, it's possible to create it later on (or update) using SQL statements.

    I would say best thing to look then is MediaPortal's source :) Under WindowPlugins there is whole Music part.
     

    Melloware

    Portal Pro
    October 26, 2007
    83
    1
    Home Country
    United States of America United States of America
    That is great advice. I appreciate the feedback at least now I have a place to look!
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: Plugin Development Questions (Database Related)

    I can only tell you about MP2.
    In MP2, we currently use an SQL server CE, but all implementations must be independent from the actual database. The database access layer abstracts very much from the actual database so that it should be possible to develop code without the knowledge about the actual database. Furthermore, if your storage requirements are not very exceptional, the MediaLibrary should still satisfy your requirements as it is very flexible and extendible.

    To answer your question if you should develop for MP1 or 2, you should know that MP1 is the CURRENT MediaPortal version which will still be the main MediaPortal version for at least another half of a year. Sometime in 2011, we'll switch to MP2, which should be usable them. So if you start developing now, probably it's the best to develop for MP2. You'll need time to work into it.

    About the licensing, as far as I understand it, if you use MP as basis for your code, you also have to open your code. But I might be wrong. Read the GPL for further information.
     

    Melloware

    Portal Pro
    October 26, 2007
    83
    1
    Home Country
    United States of America United States of America
    Mike,

    I have read those points of view on libraries/plugins and GPL which brought me to come here and ask the questions. It is still very unclear even from that Wiki article some argue that dynamically linked libraries do not count others argue all libraries count.

    In this case it would be a dynamically linked library (MP Plugin) meaning it is linked at Runtime when the main MP app scans for plugins and loads them.

    I think the Wordpress example closely resembles this situation we are referring to which is why I posted it.

    1. WordPress is a GPL app and MediaPortal is a GPL app.

    2. Both Wordpress and MediaPortal offer a plugin/extension mechanism.

    3. According to that article commercial plugins may be written for a GPL application as long as they do not get packaged WITH the GPL app nor do I distribute the GPL main app in my plugin distribution. It is purely a standalone download.

    So I think the Wordpress example is 100% identical to this situation. The only difference I see is that Wordpress is PHP and MediaPortal is C#.

    I was hoping a member of the MP development team would clarify this. The fact that the GPL is so confusing and obtuse is the reason most open source projects stay away from it.....

    From the comments of that article...

    You make a good point, but it doesn’t adress the question of whether plugins are “derivative works”. If they are, they still have to be GPL-licensed even if not distributed together with WordPress.
    #
    Hackadelic
    August 8th, 2009 at 2:45 pm

    W-Shadow, basically the main (and actually only) argument that a plugin is “derivative work” is that it is calling platform code. IMO that’s a misconception. I just commented on the topic elsewhere, so I’ll simply quote myself here: :)

    Calling WP functions is essentially executing code, not deriving from it. You build every software in the context of some knowledge, and in case of WP plugins it is the knowledge about the WP API. That doesn’t mean you derive your plugin’s functionality from that of WordPress. That would be a ridiculous statement, no matter the lines of code. It would mean that interfacing with 3rd party software is “deriving” from it. Or that coding a PDF reader from scratch is work derived from Adobe’s PDF code, just because you rely on the PDF format definition (which IS your interface in that case).

    The point is, plugins are not derivative work (except they are indeed a variation of some WP code, and are not merely interfacing with it), even if they are dependent work.

    I’m not a lawyer though…


    So I think the argument comes down to is a plugin a "derivative" work or not? My head is spinning trying to find the answer but I feel like the answer might be YES it is and therefore a commercial plugins for MediaPortal are not viable.
     

    rekenaar

    Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    I am also not sure about the legal stuff since I have not yet study the licencing...BUT...
    To be honest, I am not sure there will be a market for a commercial MP music plugin.

    Not sure how MP2 will handle it but for MP1, you have the build-in music database. You can create your own database-views and combining with the fanart-handler to get backdrops, it is already very nice. User just have to take the first step to switch from SHARES view to a DATABASE view.

    Combine the existing functionality with the great innovative ideas from our devs and community plugin-devs, spending free time on MP as hobby, then I am just wondering if it will be profitable for you.

    Please do not see this a negative feedback. Just sharing my opinion on the facts available to me. For all I know you have lots of secrets that will proof me wrong :D

    More reading:
    https://forum.team-mediaportal.com/listen-music-99/guide-music-section-mediaportal-77404/
    fanart-handler - Project Hosting on Google Code
     

    Users who are viewing this thread

    Top Bottom