SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-27-2011, 09:28 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Service mode vs client in v7

I am trying to get SageTCPServer to be configurable within the plugin interface... Currently, one instance is loaded from sage.properties (to pull the list of recordings and so on, or to control extenders) and another is loaded on any software client, like the server's UI, in order to control it (UI navigation, playback, etc.). Each instances monitors different TCP ports for communication with other pieces of software.

While I guess a software client on a different PC might be able to install a local copy of a plugin and configure it... What happens with the server's UI, since that's also where you would configure the service mode plugins...

My guess is that I should also submit an identical copy as SageTCPServer-client and set it as Desktop only, but maybe that's overkill...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #2  
Old 01-27-2011, 11:02 AM
gplasky's Avatar
gplasky gplasky is offline
SageTVaholic
 
Join Date: Jul 2003
Location: Howell, MI
Posts: 9,203
You might want to take a look at shadeblue's info popup/caller ID plugin. There is a InfoPopup/CaleerID plugin in General that is installed on the server. I can see it as an installed plugin from a client PC and I can configure it from there. He also has the InfoPopup STVI in the UI Mod that needs to be installed on any PC client you want the popup to show up. Maybe look at doing it similar to that?

Gerry
__________________
Big Gerr
_______
Server - WHS 2011: Sage 7.1.9 - 1 x HD Prime and 2 x HDHomeRun - Intel Atom D525 1.6 GHz, Acer Easystore, RAM 4 GB, 4 x 2TB hotswap drives, 1 x 2TB USB ext Clients: 2 x PC Clients, 1 x HD300, 2 x HD-200, 1 x HD-100 DEV Client: Win 7 Ultimate 64 bit - AMD 64 x2 6000+, Gigabyte GA-MA790GP-DS4H MB, RAM 4GB, HD OS:500GB, DATA:1 x 500GB, Pace RGN STB.
Reply With Quote
  #3  
Old 01-27-2011, 11:49 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by gplasky View Post
You might want to take a look at shadeblue's info popup/caller ID plugin.
Thanks, indeed that's the same kind of issues he had moving to the SageTVPlugin interface. So I am looking through his thread.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #4  
Old 01-27-2011, 12:18 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Why do you need to install anything on the client? Code running on the server can invoke API methods on any client using the appropriate UI context. This includes using SageCommand() calls to navigate the UI. (This is how the web server's remote control feature works, for instance.) So all you should need is to install one instance of your plugin on the server and have it instantiate an internal class for each client it wants to control. You should then be able to configure them all from one screen.
__________________
-- Greg
Reply With Quote
  #5  
Old 01-27-2011, 12:43 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by GKusnick View Post
Why do you need to install anything on the client?
Based on the info/popup thread, indeed I don't anymore. Though I'm not sure that when the original project (SageCQC by Beelzerob) was started 4 years ago, it would have been the case.

Quote:
Code running on the server can invoke API methods on any client using the appropriate UI context.
Right, but I don't know how easy that was to do before the GetConnectedClients() of SageTV 7.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #6  
Old 01-28-2011, 03:23 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by GKusnick View Post
Code running on the server can invoke API methods on any client using the appropriate UI context.
I'm trying to get the list of context with your library, but it's not working, any ideas? This is in service mode with the server's UI that should appear in the ConnectedClients...

Code:
Global SageGlobalApi = new Global(API.apiLocalUI);
String[] listOfContextNames = SageGlobalApi.GetUIContextNames();
String[] listOfExternalContextNames = SageGlobalApi.GetConnectedClients();
Both lists are empty... I've tried variations like API.apiLocalUI.global.GetUIContextNames() or using API.apiNullUI, but I still didn't get anything.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #7  
Old 01-28-2011, 01:36 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
It's a bit weird to be using apiLocalUI in service mode, since there is no local UI in that mode. I would use apiNullUI in that case.

Also you don't need to instantiate the Global class yourself. Every instance of API already has an instance of Global. So apiNullUI.global.GetUIContextNames() would be the intended way of accessing it.

All of that said, however, I'm not seeing any obvious reason why your code shouldn't work. The only time both lists would be empty is when the service first boots up, before any clients or extenders have connected (or after they've all disconnected). Have you checked the logs for exceptions?
__________________
-- Greg
Reply With Quote
  #8  
Old 01-28-2011, 02:15 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by GKusnick View Post
It's a bit weird to be using apiLocalUI in service mode, since there is no local UI in that mode. I would use apiNullUI in that case.
Right, that's why I tried both. One of these days I'll clean up the source code from all the initial guess work that went in...

Quote:
Also you don't need to instantiate the Global class yourself. Every instance of API already has an instance of Global. So apiNullUI.global.GetUIContextNames() would be the intended way of accessing it.
OK, I tried either but had the same effect anyway.

Quote:
The only time both lists would be empty is when the service first boots up, before any clients or extenders have connected (or after they've all disconnected).
That's most likely the problem. I was hoping to pre-configure my plugin on launch, but it makes sense that there are no context available yet (and that would be why I had left a comment in my code about the clients possibly not being connected then). I am doing it in the Start(), but I likely need to delay it even further than that. The proper way would probably be to use a listener for ClientConnected and add any unknown ones.

Quote:
Have you checked the logs for exceptions?
Yes, those were some clean empty String[], no null, exceptions or anything.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad

Last edited by Fonceur; 01-28-2011 at 02:21 PM.
Reply With Quote
  #9  
Old 01-28-2011, 06:07 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
OK, so from the getConfigSettings I do find the server's UI context through GetConnectedClients(). The bad news is that it uses a different local port each time the SageTV service is restarted, so I won't be able to use it on the next relaunch...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #10  
Old 01-28-2011, 06:30 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Right, you have to strip off the port before saving it away, and then match it back up by IP next time it reconnects.

In fact you probably want to translate the IP to a host name and match by that instead of by IP, in order to be invariant across DHCP lease reassignments.

For extender and Placeshifter clients, the MAC address is probably the appropriate invariant to use. (You can have more than one Placeshifter connection from the same host/IP, so long as they have different MAC addresses.)
__________________
-- Greg
Reply With Quote
  #11  
Old 01-28-2011, 07:54 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I'm really hoping that at some point in the future of SageTV, the Client/Server model gets reworked a bit to avoid some of these hassles. There's really no reason for keeping the extenders/placeshifters IN the server process. Things would end up being much smoother if the server ONLY ever did recording/serving, and ALL clients connected to it via a standardized protocol. Even if extenders/placeshifter's still ran on the server hardware, it would be MUCH easier if the server launched a new JVM with that handled that particular connection, and it communicated with the server process via the same IP protocol that the full clients do. Then, you'd have no reason for these UI hosts to even be ON the server.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Service Mode wont let client change channels CloudWraith SageTV Software 1 12-03-2010 06:35 PM
Converting from Client to Service Mode jturner421 SageTV Software 2 12-22-2007 01:47 AM
Sage as a client while in Service mode ptaylor SageTV Software 2 02-21-2006 05:18 PM
sage client fails with server in service mode folly12345 SageTV Software 2 05-22-2005 05:04 PM
Client stopped working when using Service mode srothwell SageTV Software 5 11-13-2004 01:54 PM


All times are GMT -6. The time now is 09:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.