|
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
|
||||
|
||||
Help with Studio properties
I am struggling with an issue in Studio that seems to be a timing problem with setting/getting a property. The attached picture shows a snippet of Studio code that executes in the before menu load hook.
Notice at the end of the code snippet I have a DebugLog statement that prints if ScreenLocked is not equal to true. Quite often this will fire and print the following to the log: "***TIKI: Unlocked [false]{true}" Of course when this happens, I don't get the desired results (In this instance it should be locked (true)). How can this happen? Is the writing of the property file asyncronous? Is it cached for later? If it's cached, shouldn't the reading of the property be looking at the cached version? The property "tiki/lock_videos" gets set in a separate configuration screen. Sometimes if I wait a long time between when I set the value in the configuration screen and when I enter the video browser screen it will work correctly. Or if I exit and re-enter the video browser screen it will work correctly. If anyone can explain what is going on, please let me know. Or, if anyone has a better suggestion of how I should be doing this to ensure that the value I am using is "fresh" let me know too.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR Last edited by Opus4; 01-17-2011 at 09:15 AM. Reason: removed inline display of attached image because it is too wide |
#2
|
||||
|
||||
First of all, property values are stored in the file as text and returned from GetProperty as Java Strings. If you want a boolean-valued property, it's up to you to convert the resulting String to a boolean (using, for instance, java_lang_Boolean_parseBoolean).
In the same vein, note that GetProperty("someprop", true) is equivalent to GetProperty("someprop", "true"). In other words, the second argument is converted to a String before it's passed in to GetProperty (and likewise for SetProperty). The other thing that strikes me as odd is the fact that you're doing AddStaticContext in a BeforeMenuLoad hook. AddStaticContext is meant for passing values from one menu to another, so typically you would call it just before linking to a Menu widget. If you want a permanent global variable, use AddGlobalContext. If you want a variable whose scope is limited to the current menu, use an Attribute widget. Finally, just as a stylistic note, it's a bit weird (in my opinion) to test a boolean using "If bool == true". Just say "If bool"; it means exactly the same thing, and it's how booleans are meant to be used.
__________________
-- Greg |
#3
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
Thanks for the pointers, I will try cleaning things up and see if it makes a difference. I'm going to have to take a closer look at my sloppy code to see why it works at all - most of the time it does work as intended even though as you pointed out, true should never evaluate to "true" and false should never be "false".
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#4
|
||||
|
||||
Well, the widget interpreter does do some implicit conversions that Java doesn't do. In fact if you enter "true" == true into Expression Evaluator, it comes back true. So I'm not sure what to suggest other than to put in some more DebugLog calls to make sure your variables and properties contain what you think they do.
__________________
-- Greg |
#5
|
||||
|
||||
Quote:
I changed the AddStaticContext call to an attribute declaration. I also explicitly cast the return from GetProperty() as a Bool as you suggested. The one tricky thing was that it would not work at all if the attribute was declared immediately below the BeforeMenuStarted Hook. I had to move it up a level so that the attribute was defined at the menu level (Immediately below the Browser-Videos Menu Item) otherwise it appeared as "Null". I guess it makes more sense to declare the attribute at the menu level anyway, but I was under the impression that an attribute widget could be placed anywhere and its scope would simply be limited to the branches of widget code that had the same parent widget as the attribute. At least that is how I interpret what is written in the studio manual.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#6
|
||||
|
||||
Quote:
If you want the variable accessible from other parts of that menu, you need to place the attribute widget at the menu level. If it isn't going to be used anywhere other than in that section of code in the BeforeMenuLoad hook, then you don't even really need to define it as an attribute anywhere - it isn't considered the cleanest form of coding, but an automatic variable will work for a short section like that. - 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. |
#7
|
||||
|
||||
Quote:
Wait, now I know how I did it - I had a very similar attribute declared somewhere else and I copied and pasted it, then edited it. I just tried again and I see that Studio allows this. So apparently Studio checks when creating a new widget by dragging from the toolbar, but there is no check when pasting a copied widget.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#8
|
||||
|
||||
Quote:
- 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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sage.Properties = SageClient.Properties? | PeteCress | SageTV Software | 10 | 01-11-2011 12:32 PM |
Command line properties.properties? | aflat | Batch Metadata Tools | 2 | 06-10-2010 04:04 PM |
Difference between SageClient.properties and Sage.properties? | morfinx | SageTV Software | 1 | 12-30-2006 09:01 AM |
any chances of altering the graphics in sage without studio? studio users please read | reboot_this | SageTV Customizations | 1 | 12-03-2004 04:03 AM |