Questions on writing my first plugin (1 Viewer)

morpheus_xx

Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    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
    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

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    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
    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
    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

    Last edited:

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    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
    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

    Last edited:

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    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
    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
    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 (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    Rob Hexenmeister Skinning Online Videos question OnlineVideos 2
    Rob Hexenmeister Quick question - skinning MyPics General Support 7
    Lichloathe Trakt for MP2 question General 7
    J TV Server setup question Newcomers Forum 0
    A Question about Google Drive sync Feature Requests 3
    C Looking at transitioning from SageTV, but have some questions Newcomers Forum 1
    X Question about Google Token activation of Youtube MediaPortal 1 Talk 0
    P Another Fast Forward/Rewind/Skip/Replay Question General 3
    doskabouter Skin question Skins and Plugins Installer (MPEI) 1
    S Newbie questions Newcomers Forum 17
    M Tuning channels with quad tuner question General 6
    ajs [Help Us!] Extensions plugin question MediaPortal 1 8
    J Trying out MP 1 again, have some questions and a few log files Newcomers Forum 5
    J Question about thumbnail decorations MediaPortal 1 Talk 0
    D A couple of DVD questions General 2
    J A question regarding Slingbox-like capability online General 3
    U 2 questions Newcomers Forum 1
    J silly question: where do I add my login details!! OnlineVideos for MediaPortal 2 5
    BlueMax1916 Titanium Extended Theme Screensaver Question Skins and Design 6
    mrmojo666 beginner: trying to write a plugin, need help to catch event General Development (no feature request here!) 3
    lacanox XMLTV not writing the tv schedule Electronic Program Guide 3
    M Need advice on writing plugin that modifies EPG database TV-Server 2
    joecrow 1.25.0 Radio Time plugin fails after Resume from Sleep with MP 1.25 Bugreports 4
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    E aktuelle englische Forums Webseite von - Showtime Plugin v3 Plugins & Erweiterungen 4
    Top Bottom