NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 3 4 5 6 7 … 93 Next »
API Help

 
  • 0 Vote(s) - 0 Average
API Help
Jokabomo
Offline

Junior Member

Posts: 17
Threads: 7
Joined: Feb 2016
#1
2016-02-08, 06:55 PM
I would like to create a small plugin. I have looked at the (really sparse) docs here. I have looked at NShared and NUtility in the VS Object Browser. None of that has been much help.

Can anyone suggest some sites that might help learn this API? I've searched these forums but a lot of the posts are old and probably outdated.

Specifically, I would like to get the tuner(s) status. This post looked helpful but ScheduleHelperFactory.GetScheduleHelper() returns null.

Basically what I am doing: I just installed NPVR. I had an old programmable remote collecting dust and a spare Arduino UNO so I decided to create an IR receiver to control NPVR. Pretty easy simply injecting keyboard shortcuts. Now I figure it might be helpful to add some LEDs to display tuner status.

Thanks.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2016-02-08, 07:40 PM
The best info for developing plugins is probably to read the thread at the following url, and look at the samples. That said, that's mainly focused on creating screens etc.
http://forums.nextpvr.com/showthread.php...o-we-start

Quote:Basically what I am doing: I just installed NPVR. I had an old programmable remote collecting dust and a spare Arduino UNO so I decided to create an IR receiver to control NPVR. Pretty easy simply injecting keyboard shortcuts. Now I figure it might be helpful to add some LEDs to display tuner status.
Usually for remotes etc, this would be done outside of the application, and you'd just send keystrokes to the application process.

If you really wanted to do it as a plugin running with in the NextPVR.exe process though, you basically create a .NET dll, which includes a class that implements the NUtility.IEventNotification notification interface. Put your dll in a directory under C:\Users\Public\NPVR\Plugins, and NextPVR.exe will find it and load your plugin when it starts. This type of plugin was really intended for developers wanting to get notifications of events, but it will get you plugin loaded, then you can send keystrokes etc.

If you decided to go down that path, I'm happy to help you through the process or any problems you encounter.
Jokabomo
Offline

Junior Member

Posts: 17
Threads: 7
Joined: Feb 2016
#3
2016-02-08, 09:29 PM
Thanks for the quick reply. I already have the remote control stuff working as a standalone program. Now I would like to write a plugin to get tuner status - unless there is a better way.

I read the posts in your link and have a few questions if you don't mind:

1. I guess NPVR uses reflection to determine which class to use. What are the requirements? What classes/interfaces is the plugin required to implement?
2. Do all plugins have to have a UI? I'm looking to write something that runs in the background or periodically.
3. What initiates the plugin to display itself? Can a plugin pop-up a message window whenever it wants? Something like a caller-id pop-up?

Thanks again.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#4
2016-02-08, 09:49 PM
Jokabomo Wrote:1. I guess NPVR uses reflection to determine which class to use. What are the requirements? What classes/interfaces is the plugin required to implement?
Just having a class that implement's NUtility.IEventNotification will be enough to get your plugin loaded. Yes, it'll use reflection to find classes that support the plugin interfaces.

Quote:2. Do all plugins have to have a UI? I'm looking to write something that runs in the background or periodically.
No, you don't need a UI.

Quote:3. What initiates the plugin to display itself? Can a plugin pop-up a message window whenever it wants? Something like a caller-id pop-up?
Usually plugins that have a UI show up in the main menu, and the user manually selects it. If you just want to show messages over whatever screen is active, you can call:

PluginHelperFactory.GetPluginHelper().ShowMessage("Some message to display");

If you want a more substantial screen, with controls for the user to interact with etc, then you can call the following API:

PluginHelperFactory.GetPluginHelper().ActivateScreen(myUIClass);
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#5
2016-02-08, 09:56 PM
Maybe for tuner status look at the source to this http://127.0.0.1:8866/public/services/InfoXML.aspx which is in web\public\services\infoxml.aspx.cs. You can simply call the url and parse the xml or follow the example on how to use scheduleHelper.

Martin
BrettB
Offline

Posting Freak

Saint Paul, MN, USA
Posts: 2,665
Threads: 170
Joined: Jun 2007
#6
2016-02-09, 04:31 PM
mvallevand Wrote:Maybe for tuner status look at the source to this http://127.0.0.1:8866/public/services/InfoXML.aspx which is in web\public\services\infoxml.aspx.cs. You can simply call the url and parse the xml or follow the example on how to use scheduleHelper.

Martin

I would agree with Martin that this solution seems to fit your use case much better. With this, you keep your program as a stand-alone image, you aren't dependent upon a NextPVR.exe front-end client being running at all (so your indicator LEDs would show accurate info either way), and you don't run into issues with multiple copies of add-in code being run when/if you have clients also accessing the server.
Jokabomo
Offline

Junior Member

Posts: 17
Threads: 7
Joined: Feb 2016
#7
2016-02-11, 10:28 PM
mvallevand Wrote:Maybe for tuner status look at the source to this http://127.0.0.1:8866/public/services/InfoXML.aspx which is in web\public\services\infoxml.aspx.cs. You can simply call the url and parse the xml or follow the example on how to use scheduleHelper.

Martin

Thanks. I tried this but it returns "Sleeping" when the tuner is not in use and "Recording" - even when just watching live TV. I was hoping for 3 states: Sleeping, In Use (watching live TV), or Recording.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#8
2016-02-11, 11:06 PM
Because NextPVR writes LiveTV to disk it is always recording, Also from a UI perspective to me a LiveTV light would only relative to the applicable client, for all others it is effectively recording. Finally with multi-rec you can record and watch live tv at the same time what state is that?

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode