|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Determining if SageClient is running on Server in service mode
How can I differentiate between a SageClient running remotely and a SageClient that is actually running on the server (when SageTV is running as a service)?
Maybe I'm doing something wrong, but I found some rather odd behavior with using GetProperty() in a Plugin implementation class. If you use GetProperty() in the Plugin code, and the code is invoked from a SageClient running on the server when SageTV is in service mode, GetProperty() returns the property from the sage.properties file and not the sageclient.properties file. Invoking the same code from a "real" SageClient (running on the network someplace) GetProperty() returns the value from the sageclient.properties file. I realize this is probably because the implementation class can only have one instance on the server, but it's still a little odd IMHO and certainly confuses things a bit. What I am doing is setting a property (using SetProperty()) in the STV code and then trying to retrieve it from the Plugin implementation class.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. Last edited by tmiranda; 02-12-2011 at 08:18 AM. |
#2
|
||||
|
||||
After re-reading the docs I think IsClient() && IsServerUI() is what I am looking for. More testing needed.....
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#3
|
||||
|
||||
Java plugins installed on the server run by default in the service process, not the UI process. If you intend for it to run in the UI process, tag it Desktop in the manifest. (However this may cause installation problems on Linux, where there is no Desktop client.)
__________________
-- Greg |
#4
|
|||
|
|||
I am currently using the following to determine if it is a client:
Global.GetUIContextName().equalsIgnoreCase("SAGETV_PROCESS_LOCAL_UI") || Global.IsClient() || Global.IsServerUI() || Global.IsDesktopUI() For some strange reason, i have found that on a client, the IsClient() seems to work, but for a client running on a server, all the calls seem to return null, but the GetUIContextName() does return the "SAGETV_PROCESS_LOCAL_UI" value, which is usually only a client, since placeshifters and extenders return the MAC address... Thanks, Jeff PS. Sorry I hadn't responded to your email.. been tied up with work problems... |
#5
|
||||
|
||||
Quote:
Normally when GetProperty() is called in the Plugin from a placeshifter, or extender (or a SageClient not running on the server) it retrieves the property from the appropriate "client" property file. In the one case I mention above when SetProperty() is called from the STV it puts the property in the SageClient.properties file and the Plugin retrieves properties from the Sage.properties file. I think the solution is to detect the special case in the STV and then make sure I put all of the properties for that special case in the server properties file.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#6
|
||||
|
||||
This seems like a bad solution to me. Client properties belong in the client-specific properties file, where Get/SetProperty puts them. If your Java plugin is not accessing the correct file, then your solution is either to make sure it runs in the UI process (using the Desktop tag as I mentioned earlier), or if it must run in the service process for some other reason, then use the appropriate client UI context when making your Get/SetProperty calls.
__________________
-- Greg |
#7
|
||||
|
||||
I've been using
Code:
sagex.api.Configuration.GetProperty(sagex.SageAPI.getUIContext(), "blah/blah", true) John Last edited by JREkiwi; 02-12-2011 at 04:03 PM. |
#8
|
||||
|
||||
Quote:
Another solution is to create my own settings dialog and forget about using the Sage Plugin Config options. That's probably the cleanest thing to do.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#9
|
||||
|
||||
Quote:
If the only purpose of your General plugin is to provide a config screen for your STVI (aka "UI mod") plugin, then you might want to take a look at my STVI Configurator, which allows you to write plugin config methods in Studio code rather than Java, and still use the built-in plugin config machinery instead of having to roll your own config dialog.
__________________
-- Greg |
#10
|
||||
|
||||
Quote:
Quote:
I moved the config options to a new dialog and I think that is actually the best way to go. It provides more uniformity with the other dialogs and cuts down on complexity. As always, thanks for your help and insight. I'm glad you take the time to help newbies.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#11
|
||||
|
||||
Quote:
Code:
If !IsClient() && !IsRemoteUI() |--InfoText = "Service Mode: " + If(GetProperty("client","")=="true", "Enabled", "Disabled") - Andy
__________________
SageTV Open Source v9 is available. - Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1. - Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus - HD Extenders: A) FAQs B) URC MX-700 remote setup Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request. |
#12
|
||||
|
||||
Quote:
If you are extending the sagex AbstractPlugin and using the addProperty() methods to build up your configuration, then can you can assign your own persistence to each each property as well, by setting a custom IPropertyPersitence implementation. (you can also set a visiblility handler and a validation handler) So, if you build your panel, then you'll probably still need to solve where you store configuration,etc. If you haven't looked at the AbstractPlugin in sagex, it's worth checking it out. It allows you to easily build up your configuration, use alternate persistence models, and easily handle onchange events (or register yourself as a listener to other events) using annotations. Here's the AbstractPlugin, and here's a couple of implementations to see how it's used; Sagex Service Plugin; Phoenix Metadata Plugin. Bottom line, I don't think you need a custom ui panel, you can probably do what you need using the existing plugin configuration panels.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#13
|
||||
|
||||
Thanks for the help.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Client lockup only when server is running service | pratt733 | SageTV Software | 4 | 04-21-2008 09:58 AM |
Q: SageClient mode w/ Sage Service not saving into SageClient.properties | laurenglenn | SageTV Software | 2 | 06-17-2007 09:22 PM |
Sage service mode and media server | sunray | SageTV Software | 0 | 07-02-2006 11:39 PM |
Running as service mode, no go. (anymore) | pciccone | SageTV Software | 0 | 12-29-2004 07:15 AM |