SageTV Community  

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

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2016, 11:28 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Context names in the API?

There is a text file, I think it is called extenders.properties in the webserver folder, that contains names for all of your extenders that is linked to their MAC IDs.

The web client uses this to show a "friendly" name on the Sage web home page so that it shows "Kitchen" rather than something like 01fd2a364f8.

Is there a way to access these names via the API or do you have to read and parse the text file?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #2  
Old 01-07-2016, 11:41 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
I don't remember the details, but I thought there was something added to the api in 7.0 or 7.1 that replaced that text file with something in the api so that everyone could use the same aliases. I'd have a look at the webui source code to see if that change was made or if I'm just imagining stuff.
__________________
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
  #3  
Old 01-07-2016, 11:58 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
There is a text file, I think it is called extenders.properties in the webserver folder, that contains names for all of your extenders that is linked to their MAC IDs.

The web client uses this to show a "friendly" name on the Sage web home page so that it shows "Kitchen" rather than something like 01fd2a364f8.

Is there a way to access these names via the API or do you have to read and parse the text file?
Not in the sagetv apis (or the sagex apis), but there is in the Phoenix APIs.

There is a bunch of phoenix.client.* apis that deal with getting and setting ui context names.

While these names are originally in the extenders.properties, it was decided some time ago that perhaps it would be better to store them in the Sage.properties as a server property, so the phoenix apis primarily deal with getting and setting the extender name in the server properties. When stored in the Sage.properties, it means that anything can access the names, under the key, sagex/uicontexts/CONTEXTNAME

There is also a phoenix.client.LoadWebServerExtenderNames() api that will load the extender properties and return them as a map, so you can get the pretty name, if configured there, using the context name as the key.

Either way the phoenix.client.* apis provide access to both ways of getting the "pretty" names.
Reply With Quote
  #4  
Old 01-07-2016, 12:27 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Thanks Stuckless - so how do the names initially get loaded into the properties file? I see in some of the code that it does read the extenders.properties file. So is the "gold" copy kept in this file and if you change it there it then gets updated in sage.properties?

What happens if someone changes the name through the web server - does the change get immediately propogated back into sage.properties or does that happen when Sage starts up the next time?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #5  
Old 01-07-2016, 02:33 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
Thanks Stuckless - so how do the names initially get loaded into the properties file? I see in some of the code that it does read the extenders.properties file. So is the "gold" copy kept in this file and if you change it there it then gets updated in sage.properties?

What happens if someone changes the name through the web server - does the change get immediately propogated back into sage.properties or does that happen when Sage starts up the next time?
I'm not sure.... I never worked on the webserver stuff... but I thought that when webserver updated the extender.properties, it would add it to the sagex/uicontexts as well. There is nothing in the phoenix code to do that, but likely it should.
Reply With Quote
  #6  
Old 01-08-2016, 03:06 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
I am getting an error which I think is related to how I am trying to call the Phoenix apis.

This code is failing - the import line is ok so it can find the API but it doesn't like how I am calling it. What prefix do I use for the API class? I have tried client., phoenix.client., and ClientAPI. and none of those two work.

Code:
import phoenix.client.*
println phoenix.client.LoadWebServerExtenderNames()
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #7  
Old 01-10-2016, 07:44 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by wayner View Post
I am getting an error which I think is related to how I am trying to call the Phoenix apis.

This code is failing - the import line is ok so it can find the API but it doesn't like how I am calling it. What prefix do I use for the API class? I have tried client., phoenix.client., and ClientAPI. and none of those two work.

Code:
import phoenix.client.*
println phoenix.client.LoadWebServerExtenderNames()
I don't think LoadWebServerExtenderNames() returns a string, I'm pretty sure it returns a HashMap of MAC addresses and Friendly names. I'm not sure what the expected behavior for println or a hashmap is (my guess would be whatever error you are seeing). You might try:
println phoenix.client.LoadWebServerExtenderNames().toString()
and see what happens.
__________________
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
  #8  
Old 01-10-2016, 08:45 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fuzzy View Post
I don't think LoadWebServerExtenderNames() returns a string, I'm pretty sure it returns a HashMap of MAC addresses and Friendly names. I'm not sure what the expected behavior for println or a hashmap is (my guess would be whatever error you are seeing). You might try:
println phoenix.client.LoadWebServerExtenderNames().toString()
and see what happens.
adding toString() is not required, since java implicitly calls toString() during any case in which you pass an object and it wants a string. So in this case the output would be the same if you used .toString() or not.
Reply With Quote
  #9  
Old 01-10-2016, 10:12 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
The issue was that static was required when calling the API, so the following code works:

Code:
import static phoenix.client.*
println phoenix.client.LoadWebServerExtenderNames()
I think this may be something unique to Groovy, although for the most part Groovy can execute Java code.

Thanks for your help folks.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
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
SageTV V7 - API: FindWidgetBySymbol on remote UI context shadeblue.com SageTV Beta Test Software 10 07-17-2010 12:45 AM
Context/ThreadLocal data jphipps SageTV Studio 2 12-11-2009 12:26 PM
Help with accessing Variables and variable Context. stanger89 SageTV Studio 6 11-01-2006 09:38 AM
Obtaining correct UI context dflachbart SageTV Studio 3 07-17-2006 07:10 AM


All times are GMT -6. The time now is 02:00 AM.


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