Questions on writing my first plugin (2 Viewers)

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Nice to see your progress :)

    I could imagine that we build some extension interfaces for SlimTv, i.e. to add more commands to the programm actions in TvGuides. This way we could use to bring more features from external (like your) plugin into SlimTv...

    What kind of interaction would you need?
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #32
    morpheus_xx,
    I was planning to contact you after i have extended the button with a "visible" feature (only show button if the plugin is installed), but I am running into another road block, as MP2 gives me an exception if the MyTestPlugin plugin is not installed and the model cannot be fined.

    If this is not working out i will ask you for implementing it in the program actions of SlimTv, but need more time to work out the final concept. I am thinking about two buttons, one for creating a new Tvwish in Edit mode (same as for the MP1 "Pog" button) and one for a quick EPG search of only the selected program to display alternative programs. But this will need more time (after my vacation) and i will contact you again in September. With your program properties you are providing all the needed information of the selected program already. Maybe only the channel name could be needed in addition.

    Thanks again for your help
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Hi huha,

    I've added support for extensions of "program actions":

    You now are able to add new commands to the list for each program (where now is only "watch now", "record" etc...). If you check my commit here (https://github.com/MediaPortal/MediaPortal-2/commits/FEAT_SlimTvExtensions) you also find the "ExampleCommand.cs" and the required registration calls from plugin.xml.
    Having this interface we are now open to add any custom action to programs (i.e. like MP1's IMDB lookup, or your tvwishlist commands).

    For the global visibility of buttons you should also check the relataed workflow-states and workflow-actions. Using them you can bring "a button" into the slimtv home screen (or any other workflow-state). And you are able to show this button depending on conditions.

    So far from my side, my vacation is now over... Enjoy yours! ;)
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #34
    Hi morpheus_xx,
    this is great news. I did continue and got the integration commands coded in Tvwishlist, but need more time for testing. I will try the integration with your registration after my vacation in 3 weeks.
    greetings, huha
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #35
    I couldn't wait to try befor the flight, but was running into an issue. While it works fine for your example, i am getting an error message with my plugin.

    I have included in the TvwishList plugin.xml

    <Builder Name="TvWishListMP2TvExtensionBuilder" ClassName="MediaPortal.Plugins.SlimTvClient.Interfaces.Extensions.SlimTvExtensionBuilder"/>
    <Register Location="/SlimTv/Extensions">
    <TvWishListMP2TvExtensionBuilder Id="{eb81047e-f3c5-4fae-8000-a67e306dfd8c}" Caption="TestCreateTvWish" ClassName="MediaPortal.Plugins.TvWishListMP2.ExtensionButtons.SlimTvCreateTvWish"/>
    </Register>

    and created my own class

    using MediaPortal.Plugins.SlimTvClient.Interfaces.Extensions;
    using MediaPortal.Plugins.SlimTvClient.Interfaces.Items;
    using MediaPortal.Common;
    using MediaPortal.Common.Logging;

    namespace MediaPortal.Plugins.TvWishListMP2.ExtensionButtons
    {
    /// <summary>
    /// Example class for definition of <see cref="IProgramAction"/>s.
    /// </summary>
    class SlimTvCreateTvWish: IProgramAction
    {
    ILogger Log = ServiceRegistration.Get<ILogger>();
    public bool DoSomethingWithProgram(IProgram program)
    {
    Log.Debug("SlimTv Button Create TvWish was pressed");
    return true;
    }

    public bool IsAvailable (IProgram program)
    {
    return true;
    }

    public ProgramActionDelegate ProgramAction
    {
    get { return DoSomethingWithProgram; }
    }
    }
    }


    it only creates an error in the log file

    [2012-08-20 13:34:00,613] [23242 ] [InputMgr ] [DEBUG] - WorkflowManager: Entering model context with workflow state '7323beb9-f7b0-48c8-80ff-8b59a4db5385' (old state was 'c7646667-5e63-48c7-a490-a58ac9518cfa') in new workflow model '5054408d-c2a9-451f-a702-e84afcd29c10'
    [2012-08-20 13:34:00,623] [23252 ] [InputMgr ] [ERROR] - PluginManager: Error building plugin item '{eb81047e-f3c5-4fae-8000-a67e306dfd8c}' at location '/SlimTv/Extensions'
    MediaPortal.Common.PluginManager.Exceptions.PluginInternalException: Builder class 'MediaPortal.Plugins.SlimTvClient.Interfaces.Extensions.SlimTvExtensionBuilder' could not be instantiated
    bei MediaPortal.Common.Services.PluginManager.PluginManager.GetOrCreateBuilder(String builderName)
    bei MediaPortal.Common.Services.PluginManager.PluginManager.RequestItem(PluginItemRegistration itemRegistration, Type type, IPluginItemStateTracker stateTracker)
    [2012-08-20 13:34:00,626] [23255 ] [InputMgr ] [WARN ] - Could not instantiate SlimTv extension with id '{eb81047e-f3c5-4fae-8000-a67e306dfd8c}'
    [2012-08-20 13:34:00,788] [23417 ] [InputMgr ] [DEBUG] - WorkflowManager: Compiling menu actions for workflow state 'SlimTvClientMultiChannelGuide'
    [2012-08-20 13:34:00,789] [23418 ] [InputMgr ] [DEBUG] - WorkflowManager: Tidying up...
    [2012-08-20 13:34:00,790] [23419 ] [InputMgr ] [INFO ] - WorkflowManager: Trying to show screen 'SlimTvClient-fullguide'...


    The full log is attached. Any idea what i am doing wrong here?

    I also tried to change in plugin.xml <Register Location="/SlimTv/Extensions"> to <Register Location="/TvWishListMP2/Extensions">, which let the error disappear, but did not show the button either.
     

    Attachments

    • plugin.xml
      7.3 KB
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Can you please share the full source code, so I can try myself?

    I guess the TvHandler (Reflection) fails to locate your assembly...
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #37
    morphues_xx,
    attached is the source code (TvWishListMP2.zip) . The skins and language files are in the resource .zip file. I had an error message when I had skins and code in one project.

    Update: In case you need the full TvWishList Package including the tv server plugin with the right version number I have attached it, too (TvWishListV1.2.3.9.Release.zip). It is not stable yet.
     

    Attachments

    • TvWishListMP2.zip
      2.9 MB
    • TvWishListMP2 Resources.zip
      171.4 KB
    • TvWishListV1.2.3.9.Release.zip
      4.9 MB
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I found the issue: your plugin.xml is missing the SlimTvInterfaces.dll, after adding it, the Builder can be found and creates your extension :)

    Code:
      <Runtime>
        <Assembly FileName="SlimTvInterfaces.dll"/>
        <Assembly FileName="TvWishListMP2.dll"/>
      </Runtime>

    In principle you would also have to add the MPExtended dll here. Then add those dlls also to you project's postbuild action copy calls.

    [2012-08-20 20:12:08,180] [40760 ] [InputMgr ] [DEBUG] - SlimTv Button Create TvWish was pressed
    :D
    Edit:
    The problem with resource files is, that you must not set "Benutzerdefiniertes Tool:MSBuild: Compile" (clear!) and "Buildvorgang: Page" (select "none"), because this would try to compile our MPF-xaml with Microsoft's WPF, which is not compatible.
     
    Last edited:

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #39
    morpheus_xx,
    a double thanks for fixing two issues. The assembly file name i would never have found.
    I will try the resource file after my return.
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #40
    morpheus_xx,
    can you give me a hint on where to disable "Benutzerdefiniertes Tool:MSBuild: Compile" (clear!) and "Buildvorgang: Page" (select "none"). I am using Visual Studio 2010 Express, but could not find an option for that. Also in the MP2 script built I was not able to see where this was used.

    I made more progress and will soon release the first stable version of TvWishListMP2. A couple of questions are still left:

    1) Is it possible in the logger to log to a separate filename. I also did not figure out how to switch between info and debug mode.

    2) Where are the nice hover background pictures defined (e.g. Slim Tv or Weather) on the MP2 start screen when the plugin is highlighted? I looked through the plugin.xml file, but could not find anything.

    3) I realized that MP2 does not have version numbers included yet when using fileinfo. Everything is 1.0.0.0 (from Easter built to Summer release). I tried to use that for detecting an older version of the SlimTv plugin. Will that be changed in the future?

    4) I had issues with the plugin configuration as the .xml file is only written when MP2 is being closed when using
    settingsManager.Save(settings);
    and is not immediately writing the .xml file. So I was not able to use my new settings when reloading in the model using
    TvWishListMP2Settings settings = settingsManager.Load<TvWishListMP2Settings>();
    , but loaded the very old file written settings from the last run. Is that a bug or did i miss anything?
     

    Users who are viewing this thread

    Top Bottom