|
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
|
||||
|
||||
Impossible "If"
Stumped again. I've got code in a UI Widget chain that looks like this:
Code:
DebugLog("1") If IsFilePath(str) > true DebugLog("2") Display Picture DebugLog("3") Display Text > else DebugLog("4") Display Something Else Tom
__________________
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. |
#2
|
||||
|
||||
Have you evaluated IsFilePath(str) separately to make sure it is giving you what you expect? If it is somehow giving you a null value that could screw things up. I often add a temporary UI chain ending with a text widget to test a call to make sure the output is what I expect.
Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#3
|
|||
|
|||
Yeah it has to be returning something other than true or false.
If you might have a null sometimes and that is okay with you, you could change the false to else, but if it is not returning a boolean than you will always get te else result |
#4
|
||||
|
||||
A null result should be caught be the else branch. The only way neither branch would execute is if the If expression throws an exception that aborts the whole chain.
I strongly recommend doing your Studio development with the console window enabled so you can see exceptions as they happen instead of having to search through logs later. Enable the console window in the registry as follows: Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Frey Technologies\Common] "consolewin"=dword:00000001
__________________
-- Greg |
#5
|
|||
|
|||
Just yesterday i was having a problem with IsFilePath. It was always returning false (even for paths that exist). I ending up writing my own method. Here is the method that i am using:
Code:
public static boolean IsFilePath(String path){ File fp = new File(path); return fp.exists(); }
__________________
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 |
#6
|
||||
|
||||
But note that your method does not distinguish between files and directories, which the Sage API method does. Maybe you meant to use IsDirectoryPath() instead? In any case, it seems confusing to name your method the same as the Sage one, even though it does something different.
__________________
-- Greg |
#7
|
|||
|
|||
Quote:
I meant to use IsFilePath() and it wasn't working for me for some reason. I passed it a valid path (to an existing file) and it was always returning false for me... I am sure I am doing something wrong I just couldn't figure it out. time to go digging i suppose...
__________________
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 |
#8
|
|||
|
|||
Quote:
|
#9
|
||||
|
||||
It definitely sounds like there may be a problem in the IsFilePath(str) API code. As mentioned, it really should ALWAYS result in either a true or a false. I mean, no matter WHAT you pass to it, it should check if it exists and is a file. If neither is true, it should return a false. I can't see how it should EVER fire an exception. Any error accessing the given path should be caught and return a false.
I wonder if the 'str' you are passing it a null? maybe then it's failing out.
__________________
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 |
#10
|
||||
|
||||
Thanks all. I replaced "If IsFilePath()" with "If true" and the same thing happens. Nothing is printed from either of the two branches (true, else). My system is possessed. Could the xml somehow be corrupted?
Thanks Greg for the console window trick, I did not know about that and it is very useful.
__________________
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. |
#11
|
|||
|
|||
Quote:
Also download babgvant registry settings it will let you enable the debug console and adjust java settings without having to work in the properties file |
#12
|
||||
|
||||
Screenshot attached. I put a "false" branch to cover all of my bases and I replaced DebugLog with THROWANERROR to see if the code ever gets executed. It doesn't - no errors are thrown. I see the DebugLog message just before the If and then nothing at all. The code just seem to skip all of the branches.
__________________
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. |
#13
|
||||
|
||||
Here is the screenshot.....
__________________
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. |
#14
|
||||
|
||||
Quote:
__________________
-- Greg |
#15
|
|||
|
|||
what is THROWANERROR? if you are calling a custom method that you wrote you need to use the full method name (ie PackageName_ClassName_MethodName)? The debug log should be throughing a bunch of exceptions though if cant find THROWANERROR.
Don't forget Greg's other trick to Notify on Errors (Tools -> Notify on Errors). That will also help you catch lots of user error (unitialized variables, Untitled code, syntax errors, etc). I find reading the console window to be hard sometimes (not big enough, cant make it wider, etc). So what i do is open sagetvclient_0.txt (the client log, same thing as the console window) in Notepadd++. Notepad++ will tell me if the file has changed and reload it. It's very handy.
__________________
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 |
#16
|
||||
|
||||
Actually you can resize the console window (or any command prompt), change fonts and colors, and so forth by right-clicking the title bar and choosing Properties. I like to set the buffer height to 1000 for scrolling back through exception chains. When done, choose "Modify shortcut" to make the changes permanent.
__________________
-- Greg |
#17
|
|||
|
|||
Quote:
__________________
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 |
#18
|
||||
|
||||
Quote:
Notify on error is on. No errors in the logfile. Nothing. No matter what I put in the true, false, else branches the code is not executed. I tried putting gibberish in the branch to see if an error pops up, and it does. (So if I change ">true" to ">kjshdfkjhg" I get an error.) I also tried changing the conditional to gibberish "If ldkslkfdgkljdf" and that causes an error as expected. So it seems the conditional is being evaluated but it never matches true, false, or else. How can that be? Greg - Cool trick on resizing the console window. razr - Notepad++ sounds good too!
__________________
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. |
#19
|
||||
|
||||
Are you sure the If itself is being reached? It looks like there's another If above it, just off screen. Have you instrumented that one to see which of its branches is being taken?
The rules for Ifs in blue UI code are a bit unintuitive. The entire tree, included all branches, gets evaluated at menu load time to instantiate the UI components. There are then additional passes for layout and rendering, during which only active branches get evaluated. So you'll sometimes see debug output triggering at unexpected times that might lead you to think a branch is active when it really isn't. You might also experiment with Studio's breakpoint and trace features. I don't use them much myself, but in a pinch they can help shed light on what's really going on.
__________________
-- Greg |
#20
|
||||
|
||||
Greg,
I'm sure (as I can be) that it is being reached because I can see the output from the DebugLog() statement (see below) just before the If in the logfile. Code:
DebugLog("PFFD:: 4.2 BannerImage = " + BannerImage) I'm really stuck at the moment. I am updating my "Phoenix Fanart for Default" STV to use the new Genre methods in the latest phoenix API. I though maybe the new phoenix jar file was causing problems so I went back to the previous version and that made no difference at all. Time to clear the mind with a beer and some football. Tom
__________________
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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Not Manual Recording" filtering doesn't work in SageTV's "Upcoming Movies" menu | vince100 | SageTV Customizations | 3 | 11-23-2009 03:56 PM |
"Sort By Title" most shows end up under "T" as in "The" | grauchy | SageMC Custom Interface | 1 | 09-25-2009 06:44 AM |
"Set defaults" for Series forgets "Keep"/"Auto-delete" setting | maxpower | SageMC Custom Interface | 9 | 05-14-2008 09:44 PM |
Stutter/Jitter using A180/Vbox and OTA? Check signal "Strength" not "quality" | svemuri | Hardware Support | 0 | 12-13-2005 10:51 AM |
Installing/Uninstalling "Got All Media" caused Sage to report "No capture device" | VorpalBlade | Hardware Support | 3 | 10-15-2005 01:30 AM |