TV Engine 3 Plugins (1 Viewer)

Stéphane Lenclud

Retired Team Member
  • Premium Supporter
  • April 29, 2013
    2,576
    1,294
    Home Country
    Germany Germany
    It's now compatible. Now I need to work out why my notification icon won't show up. Can I log stuff from the plugin? Which API do I need to use?

    Building AnyCPU, could be an issue I guess.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Can I log stuff from the plugin?
    Of course!
    Code:
    using TvLibrary.Log;
    Log.Error("This is an error!");
    etc.

    You have to add TvLibrary.Interfaces project as a reference in your plugin project to do this.

    I strongly suggest you take a look at the code for the built in plugins if you have questions like this. They're intended to be used as examples. ;)

    Which API do I need to use?
    Not sure what you mean.

    Building AnyCPU, could be an issue I guess.
    I only asked about build type because it wasn't clear to me that you'd sorted out the compatibility problem.
    As with most other things, use the other plugins as examples. Follow the conventions that they use and it is hard to go wrong.
     

    Stéphane Lenclud

    Retired Team Member
  • Premium Supporter
  • April 29, 2013
    2,576
    1,294
    Home Country
    Germany Germany
    My plugin has a dependency on a third party dll. Do I need to put it along the plugin in the plugins folder or rather in the TV Server folder? Would any of them folder work just as well?
    I tried to put it in the plugins folder but I'm not getting the feedback I'm expecting from my plugin.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand

    hurley

    Portal Pro
    February 2, 2015
    61
    57
    Home Country
    Australia Australia
    Just saw your thread link over at: Visual indicator when recording.
    I also made a related post to @Micropolis here: HTPCInfo plugin. quoted below:

    Hi @Micropolis, RE Thread: Visual indicator when recording

    I just replied to @tom_ktom about using serial port pins to drive recording indicator LED's and it struck me as a great idea for a plugin.
    My second thought was that it would be a perfect addition to your HTPCInfo plugin since you already have the infrastructure in place to monitor recording state. Rather than writing a separate plugin.
    How are you placed for free time..? If you're itching to write some more code, may I put that forward as a feature request.

    In terms of features it would ideally have:
    • Configuration page with a mapping table to map tuners/cards to serial ports and pins (DTR, RTS, BreakState).
    • Option to have user selected port/pin used to indicate any cards recording. (Main rec indicator)
    Other lower priority ideas:
    • Maybe have an option to flash the LED's if drive space is low or system temps high etc..
    • Timeshifting/Grabbing indicator.
    • Perhaps interface with Arduino.
    Open that up to other user's ideas too...

    On the code front: System.IO.Ports.SerialPort has all the pin switching guff needed.

    I've taken for granted having recording indicator LED's on my HTPC for many years, largely thanks to you sharing your source code. So big thank you for your work and sharing!
    Perhaps others would appreciate a simple way to get lights on their TV box. :)

    regards, hurley


    I should have browsed the forums before posting that^. This fits right in with your plugin idea.

    Obviously I think this is a great idea for a plugin and I'm happy to offer support, encouragement and testing feedback.
    I have the LCD/OLED and serial based LED hardware in place already.
    I am just making my way through the same learning curve with my first (TVServer) plugin and am up to the MPE Installer/Distribution stage, so this is fresh in my mind, though I don't have the experience and skill of other developers here.
    It sounds like you've flown through the base plugin/hello world stage. Keep us posted on your progress. Good luck and have fun with it. :)

    regards, hurley.
     

    hurley

    Portal Pro
    February 2, 2015
    61
    57
    Home Country
    Australia Australia
    My plugin has a dependency on a third party dll. Do I need to put it along the plugin in the plugins folder or rather in the TV Server folder? Would any of them folder work just as well?


    You could put your third party library in the TVServer Plugins folder but the TVService will try to load it as a plugin, which should fail without error.
    Don't know if that's a good idea or not. Refer to: TvService.TvServiceThread.StartPlugins() and TvService.PluginLoader.Load()

    Edit: Re mm's link: Dynamic-Link Library Search Order
    "Application loaded from directory" and "Current Directory" will both be C:\Program Files\Team MediaPortal\MediaPortal TV Server at plugin load. So above may be a moot point. (Sorry, last post edit I swear) :|

    Some tips from what I've learned:
    The IController sent to your plugin through it's Start(IController controller) method is an interface to the TVService.TVController instance. This has many useful functions for a TV Server plugin.

    Other particularly useful classes for the areas you're looking at:

    Of course as mentioned the TvServerEvents will be useful and as mm said referring to the built in plugins helped me a lot too.
    Subscribe to TvServerEvents in your plugin's Start method and unsubscribe in Close
    Code:
    public void Start(IController controller)
    {
      //...
    
      ITvServerEvent events = GlobalServiceProvider.Instance.Get<ITvServerEvent>();
      events.OnTvServerEvent += new TvServerEventHandler(events_OnTvServerEvent);
    }
    
    public void Stop()
    {
      //...
    
      if (GlobalServiceProvider.Instance.IsRegistered<ITvServerEvent>())
      {
        GlobalServiceProvider.Instance.Get<ITvServerEvent>().OnTvServerEvent -= events_OnTvServerEvent;
      }
    }

    Ah, just found my link to Version Compatibility info, knew it was in the wiki somewhere: Version Compatibility
    Also just stumbled on LEDController amongst my MePo archives. Unfortunately the original post has been deleted and there was no source code, but this looks like it did exactly what was requested in Visual indicator when recording.

    LEDcontroller.png
    Edit: Fixed link to Version Compatibility. Added git links to source references.
     
    Last edited:

    Edalex

    Community Plugin Dev
  • Premium Supporter
  • January 3, 2008
    2,955
    1,264
    Saratov
    Home Country
    Russian Federation Russian Federation

    Users who are viewing this thread

    Top Bottom