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 04-17-2009, 01:26 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
When setting or getting property

Do numbers have to be in quotes like words do?
Reply With Quote
  #2  
Old 04-17-2009, 01:33 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
No. You don't need to put true and false in quotes either.

But, you should be aware that if you are going to any math with a numerical property value, you should multiply it by 1 after getting the property to make sure it gets converted to a number rather than remains as a string.

Use: GetProperty("SomePropName",DefaultNum)*1
Because: "12" + 5 != 12 + 5

Edit: for very large numbers, see the tip in the Studio PDF manual, around p. 155.

- 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.
Reply With Quote
  #3  
Old 04-17-2009, 01:41 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Okay but that is only if I am doing math correct?

I am setting a transparancy property so I would set it just numbers no quotes.

Then when I call for it on the items transparancy

=GetProperty("propertyname")

correct?
Reply With Quote
  #4  
Old 04-17-2009, 01:48 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I probably should have left out the "math" comment... you are probably safe using it w/o multiplying by 1 (just try it), but I've learned to do that when I want to make sure it is a number so I don't accidentally make a mistake with the value at some future time if I were to modify the code.

And, don't forget that GetProperty("propertyname") needs a default value.

- 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.
Reply With Quote
  #5  
Old 04-17-2009, 01:53 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Yeah I got the default value set on the propert value

I don't need to call a default again when calling in the translucent area do I?

Thanks for all your help
Reply With Quote
  #6  
Old 04-17-2009, 01:54 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by Opus4 View Post
Use: GetProperty("SomePropName",DefaultNum)*1
While the *1 hack does work, I prefer something along the lines of java_lang_Integer_parseInt(GetProperty(...)). It's more typing, but it makes the intention crystal clear to anybody reading the code.
__________________
-- Greg
Reply With Quote
  #7  
Old 04-17-2009, 01:55 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by PLUCKYHD View Post
I don't need to call a default again when calling in the translucent area do I?
GetProperty() require two arguments, so you must pass two arguments on every call.
__________________
-- Greg
Reply With Quote
  #8  
Old 04-17-2009, 01:56 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Talk about throwing allot code at me

By the way the *1 did the trick.
Reply With Quote
  #9  
Old 04-17-2009, 10:23 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by GKusnick View Post
While the *1 hack does work, I prefer something along the lines of java_lang_Integer_parseInt(GetProperty(...)). It's more typing, but it makes the intention crystal clear to anybody reading the code.
Yeah, the *1 trick was a quick fix used a long time ago & it was just always used that way ever since. I got curious whether one way was faster... and *1 seems to be barely faster than parseInt. Then, I tried comparing to parseFloat for a decimal value & found that *1 is almost 3 times slower for whatever reason. Neither one is really that slow by itself though: over 50,000 iterations, the time was 600 ms for *1 vs 220 ms for parseFloat. <sigh> I suppose I ought to type more code in the future.

- 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.
Reply With Quote
  #10  
Old 04-18-2009, 01:29 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by Opus4 View Post
<sigh> I suppose I ought to type more code in the future.
Another option might be a family of API methods along the lines of GetPropertyAsInt(), GetPropertyAsFloat(), etc. That makes the intention clear with a minimum of extra typing (for us, anyway; not for the person who writes the API docs).
__________________
-- Greg
Reply With Quote
  #11  
Old 04-19-2009, 10:29 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Okay kind of a relates question what about when setting or getting property's for animation such as

CacheFocus or LayerForeGround

Do these need quotes. I have tried it both but when I call the property in animation it does work

using

=GetProperty("propertyname","CacheFocus")

But that doesn't seem to work I can tell the propert is getting set from the properties file.

thanks
Reply With Quote
  #12  
Old 04-19-2009, 08:59 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Check out the Animation widget property description in the Studio PDF manual, around p. 21.

I'm not sure if it is clear to anyone other than me, but the manual should indicate that if you use a dynamic value for the Animation property, then it means the widget should animate when the expression evaluates as 'true'. So, you can't assign animation layer names that way.

What are you trying to accomplish?

- 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.
Reply With Quote
  #13  
Old 04-20-2009, 06:53 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Okay good to know. I see what is says on page 21 but it says "more explained on this later"

So I need a true or false expression that is easy enough but I don't fully understand

"With dynamic
properties, animation will occur whenever the expression after the equal sign"

So I am trying to turn CacheFocus on or off based on a property

so would the correct coding be

CacheFocus = GetProperty ("PropertyName")
Reply With Quote
  #14  
Old 04-20-2009, 09:13 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
As I said in my last post: "you can't assign animation layer names that way". You either give the Animation property a layer name or it acts as a property to fire an animation.

I'm not sure I understand why the layer of a widgets needs to change. If you explained what you are trying to do, maybe someone would have a suggestion. You could always use a conditional leading up to the widgets to be shown in different ways.

- 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.
Reply With Quote
  #15  
Old 04-20-2009, 09:29 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by Opus4 View Post
As I said in my last post: "you can't assign animation layer names that way". You either give the Animation property a layer name or it acts as a property to fire an animation.

I'm not sure I understand why the layer of a widgets needs to change. If you explained what you are trying to do, maybe someone would have a suggestion. You could always use a conditional leading up to the widgets to be shown in different ways.

- Andy
Yeah I am using a conditional after reading it took more coding but works
Reply With Quote
  #16  
Old 05-12-2009, 08:42 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Question about math and integers

I am having an issue. I set a attribute widget to a property with a number

which is 2500

I then call that property later

time = GetProperty("property",2500) + 50

but the result I get is 250050 not 2550?

* merged; this was discussed above *
Reply With Quote
  #17  
Old 05-12-2009, 02:03 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
properties are all strings... you need to do the *1 workaround discussed above.
__________________
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
  #18  
Old 05-12-2009, 02:11 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Yeah I stupidly didn't think before posting this morning. I used the integer and got it to work
Reply With Quote
  #19  
Old 05-12-2009, 02:52 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by razrsharpe View Post
properties are all strings...
It's not so much that the properties are stored in the file as text. The relevant fact is that GetProperty() is documented as returning a java.lang.String, so any operation performed on that result will be interpreted as a string operation (regardless of what's in the file).
__________________
-- Greg
Reply With Quote
  #20  
Old 05-12-2009, 03:04 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by GKusnick View Post
It's not so much that the properties are stored in the file as text. The relevant fact is that GetProperty() is documented as returning a java.lang.String, so any operation performed on that result will be interpreted as a string operation (regardless of what's in the file).
Thanks for the clearification it makes sense now.
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
added property ...... where?? Stuntman SageTV Beta Test Software 0 02-01-2008 12:42 AM
experimental_video_thumbnail_generation property? popechild SageTV Software 7 06-29-2006 05:30 PM
Property setting to reconstruct a graph? Kirby Hardware Support 0 06-05-2006 06:05 PM
What is this new property? mlbdude SageTV Beta Test Software 22 04-07-2004 09:23 PM


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


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