understand the way a plugin could be written (1 Viewer)

Mike Lowrey

Portal Pro
February 4, 2009
638
124
Berlin
Home Country
Germany Germany
I've read the wiki and also reviewed the incubator projects in order to understand the way a plugin(for example an audiobook plugin) could be written. But to be honest, the amount of descriptive plugin.xml files and a somehow confusing low amount of code (with understandable functions) make me feel lost!
Can someone just add a basic example of how to expose a simple string, list and an image in an MP2 extension?
 

Albert

MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: Re: MP2 development - almost alpha state

    I've read the wiki and also reviewed the incubator projects in order to understand the way a plugin(for example an audiobook plugin) could be written. But to be honest, the amount of descriptive plugin.xml files and a somehow confusing low amount of code (with understandable functions) make me feel lost!
    Can someone just add a basic example of how to expose a simple string, list and an image in an MP2 extension?

    What exactly do you want to do?
    "Expose a string, list and an image"... What do you mean by "expose"? MP2 supports several extension points where code and resources can be added to the system. For example, you can plug in database implementations, media players, UI plugins, pure code plugins, skin extensions, language extensions, ....
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    Re: MP2 development - almost alpha state

    What exactly do you want to do?
    I'm interested in writing a simple plugin which can be accessed from the homescreen.

    Let's assume i want to write an audiobook plugin:

    If i understand everything correct i now need two plugins for MP2 one that extracts metadata from audiobook(for example mp4a files) and adds them into the database.

    And then i also have to write another plugins which access these data and displays them in the Client.

    For now the last thing is the most interesting one... It would be great to just have a simple sample project on how to achieve this...

    //edit
    Sorry, you can forget the last question... haven't found any reference to the hello world plugin till i 've read the thread about vb.net!

    The question regarding the metadata extractor still remains.

    //edit 2:
    How can i incorporate the same navigation structure like in the basic plugins...
    The SlimTVClients uses Include instead of Screen and(seems to do this by using the master_menu as source) but when using the "Screen" like done in the hello world plugin there is no working Source property(or at least it's not working like in the SlimTVClient)
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    AW: Re: MP2 development - almost alpha state

    //edit 2:
    How can i incorporate the same navigation structure like in the basic plugins...
    The SlimTVClients uses Include instead of Screen and(seems to do this by using the master_menu as source) but when using the "Screen" like done in the hello world plugin there is no working Source property(or at least it's not working like in the SlimTVClient)

    The navigation uses so called "WorkflowStates". Such a state basically contains an ID, the name of a Screen (xaml) and a Model (cs). They can be defined inside the skin: i.e. look into SlimTvClient\Skin\default\workflow\SlimTvClient-states.xml.

    The next step is to define the different navigation "step" between the different WorkFlowStates. i.e.:confused:limTvClient\Skin\default\workflow\SlimTvClient-actions.xml:
    Code:
      <MenuActions>
        <PushNavigationTransition Id="B4A9199F-6DD4-4bda-A077-DE9C081F7703"
            Name="Home->SlimTvClient"
            DisplayCategory="A-SlimTvClient"
            SortOrder="a"
            SourceState="7F702D9C-F2DD-42da-9ED8-0BA92F07787F"
            TargetState="C7646667-5E63-48c7-A490-A58AC9518CFA"
            DisplayTitle="SlimTvClient"/>
    ...

    This way you can easily add an Action to the main menu, if you define the SourceState guid to the home screen, and the TargetState to your own defined WorkFlowState.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    AW: understand the way a plugin could be written

    Yes, correctly.

    The main advantage is, that the Actions and States can be defined by the Skin. So if you want "to have an extra button here", and "hide one button there" it's up to the skin to do so.

    You could also experiment with some existing Actions file (i.e. of weather main screen) and add another PushNavigationTransition to point to some State of any available plugin. That way an plugin can add buttons to any other plugin.

    edit:
    you can set the "SourceState" also to "*" (or sth. like this), which causes the button to be present in every screen/menu
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: Re: understand the way a plugin could be written

    So only if i add a WorkFlowState the menu shows up?

    No. Correct is this:

    A menu entry shows up if a MENU ACTION is defined. The Workflow/MenuActions element in the workflow definition files contain menu actions which show up in the menu.
    One kind of actions are TRANSITIONS which make the state engine (=workflow manager) move from one workflow state to another. That's what morpheus means.
    But there are many more examples for menu actions, for example actions which call a method in a model or actions which are completely backed by a so called "workflow contributor" (interface IWorkflowContributor).
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    Thanks for your help, i will see how far i can get with these information.

    Just as a side note, may be it's just me but the whole concept seems to be really complex...
     

    Users who are viewing this thread

    Top Bottom