View Full Version : Plugin: External Status Monitor Interface
shadeblue.com
07-05-2010, 11:39 PM
Support & Comments Thread for SageTV InfoPopup V7
This plugin is for SageTV v7.0 and is available in the list of "Available Plugins" in the Plugin Manager.
I have ported Neilm's External Status Monitor Interface plugin for use in SageTV 7. This plugin allows an external program or script to connect to a TCP/IP socket and obtain information about the current state of the SageTV system. I have modified the data format to include a listing that the status information from each attached user interface (UIContext).
DATA FORMAT:
START
server_date: 2010-07-06
server_time: 00:51:52
num_ui: 1
ui_1_context: 001d6a5ca9bf
001d6a5ca9bf_now_playing_type: tv
001d6a5ca9bf_now_playing_show: Pawn Stars
001d6a5ca9bf_now_playing_episode: Rough Riders
001d6a5ca9bf_now_playing_artist:
001d6a5ca9bf_now_playing_channel: 1270 - HSTRYHD
001d6a5ca9bf_now_playing_starttime: 1278383400000
001d6a5ca9bf_now_playing_starttime_str: 21:30:00
001d6a5ca9bf_now_playing_endtime: 1278385200000
001d6a5ca9bf_now_playing_endtime_str: 22:00:00
001d6a5ca9bf_now_playing_currpos: 1278383531830
001d6a5ca9bf_now_playing_currpos_str: 21:32:11
001d6a5ca9bf_now_playing_remaining: 1668170
001d6a5ca9bf_now_playing_sec_remaining: 1668
001d6a5ca9bf_now_playing_state: play
num_recording_devs: 5
recording_1_dev: Silicondust HDHomeRun Tuner 1014FF6A-0
recording_1_show:
recording_1_episode:
recording_1_chan:
recording_1_starttime:
recording_1_endtime:
recording_2_dev: Hauppauge WinTV 418 TS Capture
recording_2_show:
recording_2_episode:
recording_2_chan:
recording_2_starttime:
recording_2_endtime:
recording_3_dev: Silicondust HDHomeRun Tuner 1014FF6A-1
recording_3_show:
recording_3_episode:
recording_3_chan:
recording_3_starttime:
recording_3_endtime:
recording_4_dev: Hauppauge HD PVR Capture Device
recording_4_show: Late Night With Jimmy Fallon
recording_4_episode:
recording_4_chan: 4 - WOAI
recording_4_starttime: 1278392820000
recording_4_endtime: 1278396360000
recording_5_dev: Hauppauge HD PVR Capture Device #2
recording_5_show:
recording_5_episode:
recording_5_chan:
recording_5_starttime:
recording_5_endtime:
END
Please see the download page for instructions and more information:
http://forums.sagetv.com/forums/downloads.php?do=file&id=387
EnterNoEscape
07-06-2010, 07:41 AM
I like this a lot. I will use this to add more detailed info to my own application, SageBanner (http://forums.sagetv.com/forums/downloads.php?do=file&id=381), such as the actual status of playback and position. These are things that could not be reliably determined with the webserver. I know there's the SageTCPServer, but it's not in the repository and I feel like this is a much easier to install and cleaner approach for my one way interface. Thanks!
shadeblue.com
07-06-2010, 02:21 PM
I like this a lot. I will use this to add more detailed info to my own application, SageBanner (http://forums.sagetv.com/forums/downloads.php?do=file&id=381), such as the actual status of playback and position. These are things that could not be reliably determined with the webserver. I know there's the SageTCPServer, but it's not in the repository and I feel like this is a much easier to install and cleaner approach for my one way interface. Thanks!
When I started working with SageTV, for simply getting current status, I found this to be the easiest method available. I am using this info in a custom home automation application to get the current media playing state and if any of the players are idle (stopped/paused) for a predetermined length of time I send an instruction to an IR emitter to power off the TV. Sort of a sophisticated sleep timer :-) So often I would fall asleep and leave the TV on all night..... no more!
EnterNoEscape
07-06-2010, 09:25 PM
You know I didn't even think about that application. I have a few HA toys. I might have to see where this could fit in.
I was just playing around with it a few moments ago, it responds very fast and seems to work quite well. Perfect for what it was made to do.
I'm assuming this is the case, but if this plugin is installed on a SageTV Client installation on a PC other than the server, you can get info from that computer directly correct?
Also, as I read from the old thread, is it necessary to change the address to 0.0.0.0 to allow all computers on any network to read the output? I think I understand the logic here; I just don't want to be using dated info. Thanks!
shadeblue.com
07-06-2010, 10:12 PM
I'm assuming this is the case, but if this plugin is installed on a SageTV Client installation on a PC other than the server, you can get info from that computer directly correct?
Also, as I read from the old thread, is it necessary to change the address to 0.0.0.0 to allow all computers on any network to read the output? I think I understand the logic here; I just don't want to be using dated info. Thanks!
Yes, if installed on a client, it should return info for that client. However, I'm working on a small change to this plugin that can get also get status info for all clients directly at the server. A new addition to the V7 API exposes this new functionality. I have attached a test copy if you want to try it out. Just shut down SageTV server, then replace the "shadeblue-getstatus.jar" file in the JARs folder. Start SageTV back up and give it a try. I don't have client PCs running the SageTV software to test out, but it is working on the local server instance of the client with SageTV configured to run as a service.
shadeblue.com
07-06-2010, 10:31 PM
Also, as I read from the old thread, is it necessary to change the address to 0.0.0.0 to allow all computers on any network to read the output? I think I understand the logic here; I just don't want to be using dated info. Thanks!
Yes, this is correct. It is set to the default address of 127.0.0.1 to be restrictive, not exposing ports outside the box by default. You have to consciously change this settings and understand that you are opening up a port to the network. You can set this to the IP address of the machine it is installed on or you can set to "0.0.0.0" which means allow connection on any interface address. So "127.0.0.1" is most restrictive and "0.0.0.0" is least restrictive. Really the only time you may want to specify a unique IP address is if you computer is multi-homed or has more than one IP address and you only want to expose this port to a single network address. Examples: you don't want to expose this port to VPN connections or if you are using a cable modem connected via USB, you don't want to expose this port to the outside world. If it is an isolated computer running internal to your network, then "0.0.0.0" should be perfectly fine.
cslatt
07-07-2010, 11:29 AM
I notice your App is written in VB.NET - just thought I'd let you know, I already wrote a client library in VB.NET for reading the output of this External Status Monitor since I do so in my MizookLcd plugin. Might save you time to use it. Should be a simple as downloading MizookLCD, adding a reference to the DLL and then in your code saying
Dim monitor as new SageMonitor(ipAddress, port, refreshInterval)
the monitor object has a NowPlaying object with all of that information and an arraylist of NowRecording objects that have the info for all of the currently recording stuff on your tuners - it handles the socket communications and parsing.
Also I can send you the source code if you're interested.
I like this a lot. I will use this to add more detailed info to my own application, SageBanner (http://forums.sagetv.com/forums/downloads.php?do=file&id=381), such as the actual status of playback and position. These are things that could not be reliably determined with the webserver. I know there's the SageTCPServer, but it's not in the repository and I feel like this is a much easier to install and cleaner approach for my one way interface. Thanks!
shadeblue.com
07-07-2010, 12:23 PM
I notice your App is written in VB.NET - just thought I'd let you know, I already wrote a client library in VB.NET for reading the output of this External Status Monitor since I do so in my MizookLcd plugin. Might save you time to use it. Should be a simple as downloading MizookLCD, adding a reference to the DLL and then in your code saying
Dim monitor as new SageMonitor(ipAddress, port, refreshInterval)
the monitor object has a NowPlaying object with all of that information and an arraylist of NowRecording objects that have the info for all of the currently recording stuff on your tuners - it handles the socket communications and parsing.
Also I can send you the source code if you're interested.
Hi cslatt,
My version of this plugin did slightly modify the message structure, just wanted you to be aware of that. I can't remember all the changes (I wrote these changes over a year ago), I know I added a few additional pieces of data.
EnterNoEscape
07-07-2010, 05:38 PM
I have attached a test copy if you want to try it out. Just shut down SageTV server, then replace the "shadeblue-getstatus.jar" file in the JARs folder. Start SageTV back up and give it a try. I don't have client PCs running the SageTV software to test out, but it is working on the local server instance of the client with SageTV configured to run as a service.
With very little effort it looks like everything is working perfectly. I tested it with my client license and the server client. Both return correct info so far. This makes my life even easier. Thank you! :dance:
EnterNoEscape
07-07-2010, 05:50 PM
Also I can send you the source code if you're interested.
Thanks for the offer, but unfortunately I already whipped up all the code to parse the output and properly open and close the connection. It was relatively trivial for me. I wrote a P2P video transcoder/comskip runner for BeyondTV back when I used it primarily that used similar TCP communications to coordinate all my computers set as encoders. I was really quite proud of it. It really hurt to have to leave such a sophisticated and neat piece of work behind. SJQ fills the void mostly. It's nice to watch someone else do the work sometimes. :D
EnterNoEscape
07-07-2010, 07:42 PM
The more I play with the client info, the more I'm realizing that having the port included with the IP address is a detriment for me because I have things set up to replace the address with a "friendly" name. Every new connection, the port changes. I can work around this by separating the port myself, but I thought I'd mention it.
shadeblue.com
07-13-2010, 12:24 AM
The more I play with the client info, the more I'm realizing that having the port included with the IP address is a detriment for me because I have things set up to replace the address with a "friendly" name. Every new connection, the port changes. I can work around this by separating the port myself, but I thought I'd mention it.
The IP address and port come directly from the SageTV API for the UI context names. I could probably add another field that strips off the port. I was also thinking of maybe adding a UI friendly name property that could be specified in the sageclient.properties file for each client and including that in the details.
texneus
03-23-2011, 09:06 PM
ShadeBlue -
Would it be possible to add a "compatibility mode" to your plugin that would make the data format backwards compatible with the legacy GetStatus plugin? I'm trying to use LCD Smartie with the Sage.dll and Mizook.dll's and neither seems to care for the new format :(.
Thank you!
I'd love to see this or Mizook update his LCD Smartie plugin; I just want LCD Smartie to be able to pull status from SageTV 7 :cool:
ShadeBlue -
Would it be possible to add a "compatibility mode" to your plugin that would make the data format backwards compatible with the legacy GetStatus plugin? I'm trying to use LCD Smartie with the Sage.dll and Mizook.dll's and neither seems to care for the new format :(.
Thank you!
pjwerdna
06-16-2011, 03:02 PM
I'd love to see this or Mizook update his LCD Smartie plugin; I just want LCD Smartie to be able to pull status from SageTV 7 :cool:
Ive not had any problems getting LCD Smartie to show now playing and recoding info.
Using external status socket interface plugin v7.0.0 and MizookLcd.dll version 1.0.2600.1.17780 dated 16/06/2010
vBulletin® v3.7.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.