![]() |
|
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
|
||||
|
||||
Setting "this" in Java
Next silly question for the night. If I have a Java method that is called from the STV, how do I set the STV variable "this"?
I tried searching but "this" is just too common a word!
__________________
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
|
|||
|
|||
This is called directly in the stv after doing something but not setting it to a variable ie
Code:
GroupByMethod(mycoolfiles,mycoolmethod) Sortlexical(this,false,mycoolsorting) |
#3
|
||||
|
||||
Quote:
Code:
myclass_myMethod() SortLexical(this, false, 'AnotherMethod")
__________________
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. |
#4
|
||||
|
||||
Just return it as the return value of the method. As Plucky said, "this" is just the final result of evaluating the previous expression. If that expression happens to consist of a Java method call that returns a value, that returned value becomes "this".
Or to say it a different way, it's like every Action widget has an invisible "this = " in front of it. So if your widget says Code:
myclass_myMethod() Code:
this = myclass_myMethod()
__________________
-- Greg |
#5
|
||||
|
||||
Something is not right with this. In my MultiUser Plugin I created methods that replace the core methods but I could not do thie with Watch() because "this" was not getting set properly. My Java code looks like this:
Code:
public static Object watch(Object content) { .... do some things ... return MediaPlayerAPI.Watch(content); } I fixed the problem but I am not 100% satisfied with what I had to do to correct it. 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. |
#6
|
||||
|
||||
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#7
|
|||
|
|||
I get the UIContext and call watch for all SMM direct from Java. But I call onto the widget chain using the widget api directly to the defaults so all the variables get passed correctly as well as I add static context from java for airing and such variables before executing the widget chain. I haven't had any issues relying on the UIContext from sagex doing this.
|
#8
|
||||
|
||||
Quote:
![]() ![]()
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#9
|
|||
|
|||
Quote:
![]() On that subject I am getting some issues with SetProperty Setting the Server property instead of the extender/local desktop property lately but haven't had a chance to track it down. I don't pass a UIContext but am tempted to start ![]() And believe me MyMovies relies on UIContext from top to bottom from reading the custom properties to playing a file and has been spot on so thanks for that ![]() |
#10
|
||||
|
||||
Did you check your logs for errors? If your method throws an exception (and fails to catch it internally), then obviously its return statement won't be executed and "this" will not be set properly.
__________________
-- Greg |
#11
|
||||
|
||||
No, but I will. I'll also check the UIContext issue that Sean and Skye pointed out to see if that's the problem.
__________________
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. |
#12
|
||||
|
||||
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#13
|
||||
|
||||
Quote:
Thanks
__________________
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:
The other reasons run an obfuscator on your code is to simple reduce the physical size of the jar file. Since java has to load all the classes into memory which includes things like classname, method name, etc, then by obfuscating the code, you end up with slightly smaller jar files that consume less memory when loaded. The other reason to use an obfuscator is to run post processing actions against the code to do optimizations like remove private methods that are never used. Or, remove public methods that are never called (can be dangerous). You can alog create rules that will entirely strip logging from a jar file. I don't know what sage uses, but I suspect it is either ProGuard or something similar. Keep in mind, when you obfuscate the code, it will give you a set of files that you can be used to "decipher" stack traces. So, when you see an obfuscated strack trace in the code that is a sage error... when you send it to them... they know exactly where in the code it died... even though you don't ![]()
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
setting new source, won't load any "local market" EPG choices | matt91 | SageTV Beta Test Software | 5 | 02-09-2011 07:36 PM |
"Backdrops" "SageTV" "Covers" folders - what's creating them | mp328 | Sage My Movies | 4 | 09-20-2010 05:31 PM |
JAVA "MainMsg"" error help | Graygeek | SageTV Software | 0 | 09-01-2009 04:04 PM |
"Set defaults" for Series forgets "Keep"/"Auto-delete" setting | maxpower | SageMC Custom Interface | 9 | 05-14-2008 09:44 PM |
Java Error? "unexpected error" "exception_access_violation" | gotuitdan | SageTV Software | 1 | 11-21-2006 10:49 PM |