[Approved] Patch to allow skins to open plugins with a parameter *Updated for 1.1* (1 Viewer)

DieBagger

Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    The original idea can be found here: https://forum.team-mediaportal.com/improvement-suggestions-46/allow-skins-plugins-parameters-74058/

    I'll outline the idea again: The patch adds a new property (hyperlinkParameter) to GUIButtonControl. This property will be passed to the plugin that is opened with the hyperlink property. The plugin can then open a specific view/site/part of the plugin, depending on the parameter.

    Here are some usecases for a few of the most popular plugins:

    MovingPictures
    The BasicHome screen contains two hyperlinks to MovingPictures with two different hyperlinkParameters
    • Link 1 is named "Kids Movies" and will open MovingPictures with the category defined for save usage by the children
    • Link2 is named "Movies" and will open MovingPictures and show all movies (it may be secured with a pin)

    MP-TVSeries

    The BasicHome of skin x contains two links to mp-tvseries each with a different hyperlinkParameter
    • Link 1 will open mp-tvseries and show Bobs Favorite series
    • Link2 will open Janes favorite series
    • Link3 will show all shows for the kids

    OnlineVideos
    BasicHome will have own icons for OnlineVideos->Youtube and OnlineVideos->GameTrailers, you get the idea ;)

    Other Plugins
    • MyTrailers can be called from other plugins with an imdb id as parameter, MyTrailers will show trailer for this specific movie
    • Weather plugin could be called for different cities
    • ...

    Implementation
    That's why I think why this patch would provide an improvement to MediaPortal, now here's what I've done:
    - Added skin property to GuiButtonControl class
    Code:
    [XMLSkinElement("hyperlinkParameter")] protected string _hyperLinkParameter = "";

    - When button is pressed and contains a hyperlink AND a hyperlinkParameter the method
    Code:
    GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId, _hyperLinkParameter);
    is called instead of
    Code:
    GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId);

    - the parameter will be added (as lpVoid) to the GuiMessage GUI_MSG_WINDOW_INIT
    - in the GUIWindow class, the parameter will be stored in the new field _loadParameter
    Code:
    protected string _loadParameter = null;
    - a plugin can then check if(_loadParameter != null) in the OnPageLoad() method

    Remarks:
    • I did consider using a second OnPageLoad(string parameter) method but this would cause sideeffects with the overrides
    • I talked to fforde (movingpictures) and damienh (mp-tvseries) and both agreed that a simple string would be sufficient as a parameter
    • This is my first patch so please be gentle :p Comments are very welcome!

    Patch: View attachment AllowSkinToOpenPluginWithParameter.patch


    Files for testing (Needs the latest svn snapshot and MovingPictures 1.0 installed), just overwrite the files with the ones included in the rar file and you'll have a BasicHome that opens moving pictures in different category views.
    View attachment LoadMovingPicturesWithSpecifiedCategory.rar
    • Modified BasicHome.xml for Blue3Wide
    • Modified MovingPictures 1.0
    • Modified Core.dll (including the changes)
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    Great enhancement, im sure others whom ask for multiple instances of a plugin will agree :)

    I will definitely support adding this to TVSeries once its approved.
     

    fforde

    Community Plugin Dev
    June 7, 2007
    2,667
    1,702
    42
    Texas
    Home Country
    United States of America United States of America
    Fantastic work DieBagger. I definitely look forward to this patch making it into MP! Well done. :)


    :D
     

    rekenaar

    Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    Great work.

    We will of course have to wait until MediaPortal 1.1.0 final has been released before the patch will be evaluated by our devs.
     

    fforde

    Community Plugin Dev
    June 7, 2007
    2,667
    1,702
    42
    Texas
    Home Country
    United States of America United States of America
    Would it make sense to evaluate now and if it looks good schedule it on mantis? Would hate to see a great patch like this lost in the shuffle.
     

    Inker

    Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    Re: Patch to allow skins to open plugins with a parameter

    Just giving this a bump as I agree, this would be a fantastic addition which opens up many new possibilities. Hope it won't be forgotten :)
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    Re: Patch to allow skins to open plugins with a parameter

    Nice Addition! Would love to see this in MePo as well.
     

    chemelli

    Retired Team Member
  • Premium Supporter
  • September 28, 2006
    6,159
    2,264
    49
    Milano, Italy
    Home Country
    Italy Italy
    Re: Patch to allow skins to open plugins with a parameter

    :D for help improving MP.

    As you may now MP is currently in feature freeze so we have to postpone the validation of your patch.

    Cheers,
    Simone
     

    DieBagger

    Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    Ok, so since the patch sadly didn't make it into 1.1, here's the updated version for the current svn. The changes I did are pretty much the same as in the original patch, I tested it with a modified version of moving pictures that will directly open the category that is specified with the parameter.

    Patch:
    View attachment AllowSkinToOpenPluginWithParameter.patch

    Compiled Testversion:

    This archive includes the patched core.dll, a modified basic home of blue3wide and the modified moving picutures binaries. Just override the existing files (don't forget to backup ;)) and you'll get a basichome from which you can directly open the following categories of movingpictures:
    • All movies
    • Unwatched Movies
    • Genres
    • Recently Added
    • Year

    View attachment OpenMovingPicturesWithParameter.rar

    :D
     

    Users who are viewing this thread

    Top Bottom