SageTV Community  

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

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #161  
Old 12-12-2009, 10:37 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
I just ran a test on the UIContext() and it does work. So, I guess I need to understand how you guys were using it.

for Example, the following will not work....
SageAPI.setUIContext("MACADDRESS");
Configuration.GetProperty("MyProp", null);

ie, just because the UIConext is set "globally" (threadlocal), the apis will not just use it. You still need to specifically tell the api that you want a context...
Configuration.GetProperty(null, "MyProp", null) will work, because by forcing it to use an API UI call, it will first use whatever context that you pass (in this case null), then use the threadlocal copy, if your is null...

You could also, use, Configuration.GetProperty(SageAPI.getUIContext(), "MyProp", null); or Configuration.GetProperty(new UIContext("MACADDRESS"), "MyProp", null);

ie, you have to explicitly call a UI context method in order for the API to pass a context to sagetv.

I hope this clarifies the UIContext stuff, as it relates to the sagex.api.
Reply With Quote
  #162  
Old 12-12-2009, 10:43 AM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
sean... thanks for the reply and explanation... jeff and i will do some debugging and see what we come up with andwe'll be back if/when we have some more questions

thanks,
Aaron
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #163  
Old 12-12-2009, 11:07 AM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
I'm a little off topic but since you mentioned it, care to tell us what 'ortus' is? And speaking of secret projects, I haven't heard much about Phoenix lately...
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #164  
Old 12-12-2009, 11:14 AM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by jreichen View Post
I'm a little off topic but since you mentioned it, care to tell us what 'ortus' is?
its a replacement stv modeled loosely after meedios and xbmc. It includes a (imho) robust api mainly focusing around metadata and 100% automatic collection of it and a very robust/customizable searching/filtering function for your media files as well as a bunch of other cool stuff

Ben (jaminben) has mainly been talking about it in the SageMC screenshot thread.

Heres a link to his most recent "leak" (and some discussion following it...)
http://forums.sagetv.com/forums/show...&postcount=598
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #165  
Old 12-12-2009, 12:45 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
Hello,

We are trying to store some objects, that some are global, and a few were going to be unique per extender. The STV calls a setup route that will instantiate the main class to setup the various server processes, and that call passes the current context name and and we were going to use the MAC address as the key for the various data objects inside of a Map. I tried various ways to call the Configuration.SetProperty() so I could store the MAC address for each client that starts since there doesn't seem to be any other way to uniquely identify what client is making the call. I tried it with the UIContext() passed and without, and for some reason it keeps writing to the server's sage.properties file instead of the clients/{mac}.properties file.

I am not sure if it is how our design is that is causing it to write to the incorrect properties file or not. I had used the Configuration.SetProperty() before, and I don't remember having this issue.

Thanks,
Jeff
Reply With Quote
  #166  
Old 12-12-2009, 01:13 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Jeff, I don't know exactly how your code is put together, but from how you explain it, it seems logical.

But, if you call SetProperty() you have to pass the UIContext as well, or else will will never call the apiUI() call in sage.

I ran the following code in my environment.... it it passed...
Code:
		String uiContexts[] = Global.GetUIContextNames();
		for (String ui : uiContexts) {
			System.out.println("Context: " + ui);
            Configuration.SetProperty(new UIContext(ui), "/test/sagex/api", "TestVal");
            String val = Configuration.GetProperty("/test/sagex/api", null);
            if ("TestVal".equals(val)) {
                System.out.println("That's not right!!  SetProperty with UI context set the server prop!!!");
            }
            val = Configuration.GetProperty(new UIContext(ui), "/test/sagex/api", null);
            if (!"TestVal".equals(val)) {
                System.out.println("That's not right!!! GetProperty with client context did not work.");
            } else {
                System.out.println("Got Client Val: " + val);
            }
	}
On my system, I get the output...
Code:
Got Client Val: TestVal
Which means that it set the property correctly. I then checked my client properties (under, clients/) and it also contained the value.
Reply With Quote
  #167  
Old 12-12-2009, 01:27 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
From your code example, how do you know which context the current calling process is using? I think you had said earlier that the GetUIContextName() doesn't work..

Thanks,
Jeff
Reply With Quote
  #168  
Old 12-12-2009, 01:36 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
I looked at the source for Greg's code, and I see he calls the GetUIContextNames() and then uses the first array item. I will give that a try and see how that works out...

Thanks,
Jeff
Reply With Quote
  #169  
Old 12-12-2009, 02:19 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by jphipps View Post
From your code example, how do you know which context the current calling process is using? I think you had said earlier that the GetUIContextName() doesn't work..
From the STV, you need to pass the current UI context into your java call. ie, something like...

ortus_api_YourAPI(GetUIContext()) where YourAPI() stores a reference to that API, and then passes it down to whatever other api calls that need it.

Quote:
Originally Posted by jphipps View Post
I looked at the source for Greg's code, and I see he calls the GetUIContextNames() and then uses the first array item. I will give that a try and see how that works out...
This will work as long as you only have a single client connected at any given time. GetUIContextNames() will return an array of all the connected clients.

The only reliable way to use the UI context is to have the STV call pass it down to your api.
Reply With Quote
  #170  
Old 12-12-2009, 02:45 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
Yep, every client I connected would write its information to the first clients properties file.

It is strange though, I tried using Greg's api for the property calls and it seem to write to the correct properties file for each client...

Do you know what he might be doing that would be different?

Thanks,
Jeff
Reply With Quote
  #171  
Old 12-12-2009, 02:47 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
ortus_api_YourAPI(GetUIContext()) where YourAPI() stores a reference to that API, and then passes it down to whatever other api calls that need it.
Can this be run once during stv load and then the UIContext is stored in the api and then all future future references to the UIContext use the stored one from when the stv was loaded or does that not work? ... (so that we do not have to continually pass it down to api from the stv)
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #172  
Old 12-12-2009, 03:03 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by jphipps View Post
It is strange though, I tried using Greg's api for the property calls and it seem to write to the correct properties file for each client...
Jeff,
During my testing this morning using Greg's api calls i did not have both clients on at the same time so i can't say for sure that his api worked as expected (unless of course you did further testing with multiple connected clients )
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #173  
Old 12-12-2009, 03:04 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by jphipps View Post
Yep, every client I connected would write its information to the first clients properties file.

It is strange though, I tried using Greg's api for the property calls and it seem to write to the correct properties file for each client...

Do you know what he might be doing that would be different?
I don't think that greg automatically selects a ui context. I just can't see him doing it, it's too risky... that's more my department My understanding of greg's api, is that you need to set the UI context... and that ui context has to come from the STV... to be configured somewhere.

Quote:
Originally Posted by razrsharpe View Post
Can this be run once during stv load and then the UIContext is stored in the api and then all future future references to the UIContext use the stored one from when the stv was loaded or does that not work? ... (so that we do not have to continually pass it down to api from the stv)
You can certainly store the UI context in a stv variable and then just pass the ui context to each java api that requires the context. It cannot be stored reliably inside of a java call. The fact that GetUIContext() does not work inside of Java is probably my biggest annoyance with the sage api. I haven't decided how I'm going to handle it in Phoenix either. Most phoenix API calls do not accept a ui context, but some do.
Reply With Quote
  #174  
Old 12-12-2009, 03:06 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
That is what I just tested. From looking at his code, I expected it to have the same issue, but it seemed to work fine. I tested with 2 extenders connecting, and the property files for each extender had the correct data, and the information in the STV ( MAC address ) all looked correct...

Thanks,
Jeff
Reply With Quote
  #175  
Old 12-12-2009, 03:08 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
You can certainly store the UI context in a stv variable and then just pass the ui context to each java api that requires the context.
so perhaps from the STV during load you do AddGlobalContext("UIC", GetUIContext() ) ... Then would UIC be available from inside java? that would be one way around not having to continually pass it down to your java code...

Quote:
It cannot be stored reliably inside of a java call. The fact that GetUIContext() does not work inside of Java is probably my biggest annoyance with the sage api.
+1

Quote:
I haven't decided how I'm going to handle it in Phoenix either. Most phoenix API calls do not accept a ui context, but some do.
ya same with us... most do not require/accept a UI context but some require it...
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #176  
Old 12-12-2009, 04:03 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by razrsharpe View Post
so perhaps from the STV during load you do AddGlobalContext("UIC", GetUIContext() ) ... Then would UIC be available from inside java? that would be one way around not having to continually pass it down to your java code...
You'd have no way to access the context variable in your java code So you could use AddGlobalContext() to set a "convenient" variable, ie, but you'd still need to pass that variable in the API call from the STV to java.
Reply With Quote
  #177  
Old 12-12-2009, 04:20 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
You'd have no way to access the context variable in your java code
bah... well aint that annoying

EDIT: i think ill request a GetGlobalContext() sage api call so you could retrieve it from your java code...
EDIT #2: but maybe this wont work for the same reason that GetUIContext() doesnt work from java
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer

Last edited by razrsharpe; 12-12-2009 at 04:24 PM.
Reply With Quote
  #178  
Old 12-12-2009, 04:46 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by razrsharpe View Post
bah... well aint that annoying

EDIT: i think ill request a GetGlobalContext() sage api call so you could retrieve it from your java code...
EDIT #2: but maybe this wont work for the same reason that GetUIContext() doesnt work from java
Yeah, I think that ultimately, you should ask the GetUIContext() actually return a valid context when invoked from java... but i'm guessing there's some technical reason as to why that will never happen. Sage could probably add a GetGlobalContext(), but you'd still have to pass the UIContext in order to get the GlobalContext for your UI session
Reply With Quote
  #179  
Old 12-12-2009, 04:53 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
Yeah, I think that ultimately, you should ask the GetUIContext() actually return a valid context when invoked from java...
yup time to start an email

Quote:
but i'm guessing there's some technical reason as to why that will never happen.
well we will never know until we ask...but youre probably right

Quote:
Sage could probably add a GetGlobalContext(), but you'd still have to pass the UIContext in order to get the GlobalContext for your UI session
ya.... wouldn't work for my purposes... obviously... gotta love circular reasoning
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #180  
Old 12-16-2009, 05:33 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
Yeah, I think that ultimately, you should ask the GetUIContext() actually return a valid context when invoked from java... but i'm guessing there's some technical reason as to why that will never happen. Sage could probably add a GetGlobalContext(), but you'd still have to pass the UIContext in order to get the GlobalContext for your UI session
Talked with Sage support and they pointed me in a direction to get a work around until they can update their api to make the GetUIContextName() from third party apis work the way it should. I started a new thread so it's easier to find.

http://forums.sagetv.com/forums/showthread.php?t=45916
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
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
Hauppauge Remote Issue yacht_boy Hardware Support 4 05-01-2008 09:25 PM
MCE remote transmitting keypresses twice arnabbiswas Hardware Support 1 02-22-2007 10:55 AM
MCE Remote not work fully with Placeshifter devinteske SageTV Placeshifter 5 02-08-2007 11:45 PM
Harmony Remote IR Reciever Help brundag5 Hardware Support 2 01-13-2007 09:08 PM
How to get SageTV to release focus to NVDVD for remote IncredibleHat SageTV Software 4 07-06-2006 07:47 AM


All times are GMT -6. The time now is 06:13 PM.


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