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
  #1  
Old 02-03-2011, 11:37 AM
michaeldjcox michaeldjcox is offline
Sage Fanatic
 
Join Date: Nov 2006
Location: Ipswich, Suffolk, United Kingdom
Posts: 829
Setting properties that are tested in an STVi

I wrote STVI for a plugin that calls GetProperty(prop, defvalue) to make choices about what to present to the user.

I noticed that currently - using setProperty and setServerProperty in the API from my server plugin both seem to set values in Sage.properties.

But the presence of my STVI in the client has led to the properties being recorded in the SageClient.properties with default values.

Is it possible to set those client properties from a server plugin?

Thanks in advance for any advice!

Michael
__________________
Web Feed Encoder developer
SageTV Catchup developer
Reply With Quote
  #2  
Old 02-03-2011, 11:45 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
SetServerProperty
And
GetServerProperty

Will always get and set properties on the server from any client or server.




Getproperty
And
SetProperty

Set and get client specific properties
Reply With Quote
  #3  
Old 02-03-2011, 11:56 AM
michaeldjcox michaeldjcox is offline
Sage Fanatic
 
Join Date: Nov 2006
Location: Ipswich, Suffolk, United Kingdom
Posts: 829
Thanks for your help.

May be its because my client and server are on the same laptop.

Calling:

SageTV.api("SetProperty", new Object[] {property, value});

from my server plugin seems only to result in Sage.properties being set and not SageClient.properties.

And hence my STVi is ignoring the properties

Michael
__________________
Web Feed Encoder developer
SageTV Catchup developer
Reply With Quote
  #4  
Old 02-03-2011, 12:23 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by michaeldjcox View Post
Thanks for your help.

May be its because my client and server are on the same laptop.

Calling:

SageTV.api("SetProperty", new Object[] {property, value});

from my server plugin seems only to result in Sage.properties being set and not SageClient.properties.

And hence my STVi is ignoring the properties

Michael
Are you running in service mode?
Reply With Quote
  #5  
Old 02-03-2011, 12:23 PM
michaeldjcox michaeldjcox is offline
Sage Fanatic
 
Join Date: Nov 2006
Location: Ipswich, Suffolk, United Kingdom
Posts: 829
I've changed my STVi to do GetServerProperty instead of GetProperty.

Seems to do the trick for now.

Michael
__________________
Web Feed Encoder developer
SageTV Catchup developer
Reply With Quote
  #6  
Old 02-03-2011, 12:24 PM
michaeldjcox michaeldjcox is offline
Sage Fanatic
 
Join Date: Nov 2006
Location: Ipswich, Suffolk, United Kingdom
Posts: 829
Quote:
Originally Posted by PLUCKYHD View Post
Are you running in service mode?
SageTV is running as a service.

Michael
__________________
Web Feed Encoder developer
SageTV Catchup developer
Reply With Quote
  #7  
Old 02-03-2011, 01:46 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
What are you trying to accomplish here? If these are global settings that apply to all clients, then you should use Get/SetServerProperty to access them. If they're per-client UI option settings, then you should use Get/SetProperty, and your backend server code shouldn't be accessing them at all.
__________________
-- Greg
Reply With Quote
  #8  
Old 02-03-2011, 02:31 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Slightly OT, but I have grown to really like the UserRecordAPI for storing data that needs to be shared among various UI instances.

100% agree that you should use SetProperty for instance specific values and SetServerProperty for values that are shared among all UI instances.

Another small gotch with properties, they are all Strings. In most cases the expression evaluator will convert them to the right type, but not all. Something like:

Code:
GetProperty("propertyname", defvalue) + 1
May result in "51" if the value of the property is "5". Multiplying by 1 will ensure conversion to an integer so you will often see things like this in Studio:

Code:
val = GetProperty("propname", defvalue)*1.0 + 1
__________________

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.
Reply With Quote
  #9  
Old 02-03-2011, 03:09 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by tmiranda View Post
Multiplying by 1 will ensure conversion to an integer so you will often see things like this in Studio:

Code:
val = GetProperty("propname", defvalue)*1.0 + 1
Multiplying by 1 will indeed convert it to an integer, but multiplying by 1.0 will convert it to a float.

My attitude on such things is that if you want to convert a string to an integer, you should say so explicitly by calling parseInt. Relying on obscure multiplication tricks to do the conversion implicitly does not make your code easier to understand.
__________________
-- Greg
Reply With Quote
  #10  
Old 02-03-2011, 04:22 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by GKusnick View Post
My attitude on such things is that if you want to convert a string to an integer, you should say so explicitly by calling parseInt. Relying on obscure multiplication tricks to do the conversion implicitly does not make your code easier to understand.
Agreed. I pointed this out because it's in the default STV and when I first looked at it I was confused.

I'm also lazy and have sometimes not followed your good advice and simply multiplied by 1 to do the conversion.
__________________

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.
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
Setting in Sage.properties for HD-PVR sdsean SageTV Software 6 04-21-2010 08:03 PM
Setting up the Sage.properties file??? agdm619 Hardware Support 12 12-26-2008 10:02 AM
Anyone tested or get Closed Caption working on HD extender TechBill SageTV Media Extender 10 04-13-2008 02:38 PM
newb tested beyond and sage - want sage but video q isnt as good? elitevsx SageTV Software 13 01-18-2006 08:45 AM


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


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