|
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
|
|||
|
|||
ExecuteWidgetChain() in server startup class
Currently I am starting certain background threads from 'ApplicationStarted' in the STV code. Does anyone see any potential problems with starting them during server startup time by writing a java runnable (load_at_startup_runnable_classes) which executes the existing STV code with ExecuteWidgetChain() ?
Dirk |
#2
|
||||
|
||||
I wouldn't regard ApplicationStarted and load_at_startup_runnable_classes as interchangeable. Consider the case of a SageTVService serving multiple Placeshifter and Extender clients. load_at_startup_runnable_classes happens just once when the service initializes. There may not be any STV loaded at all at that point. ApplicationStarted, in contrast, fires each time a client connects. If your widget threads interact with the UI or have any per-client state, then ApplicationStarted is the right place to fork them. If they need no UI or per-client state, then they probably shouldn't be widget code in the first place. Just code them in Java and launch them from load_at_startup_runnable_classes in the usual way.
__________________
-- Greg |
#3
|
|||
|
|||
Quote:
yeah I am of course aware of the differences between the startup classes and the ApplicationStarted hook. The threads do not interact with the UI, and do not have any per-client state. In fact, moving them to the server startup should solve the problems of 1) making sure that only one thread is started even if multiple clients are running, and 2) ensure that the thread is started even if no UI is running at all. But you are right, the thread code should have been all in java in the first place. There are just two reasons I hesitate to do this: - it's quite a bit of code, so it would require a lot of re-coding (lazy ) - the current widget code contains a "hook" location for other STVis to link to. This would get more complicated. If the server is run as a service, does it have access to the STV code at all (does it 'load' the STV specified in Sage.properties) ? The approach obviously wouldn't work if not... Dirk |
#4
|
||||
|
||||
Quote:
On the laziness issue, you could do what I'd probably do in a case like that. Instead of rewriting all that code in Java, write a Java app that loads the XML as a DOM document, walks the widget tree, wraps the text of each If or Action widget in a Java statement, and writes it all out to a text file. That should get you about 90% of the way there. It may not actually be any less work that rewriting the code by hand, but it would be more fun. (My laziness problem is just the opposite: I hardly ever write more than a dozen consecutive lines of pure If and Action widgets if I can write a Java subroutine instead.) I'm not sure what to tell you on the STVI hook issue without knowing more about what problem you're trying to solve with it.
__________________
-- Greg |
#5
|
||||
|
||||
Quote:
Forked threads on the server for a remote UI don't automatically end when the remote client UI disconnects, so it will keep running until your code ends that forked thread. I would suggest perhaps using one of them to do what you need, but then you would have to 1) have a remote UI start at some point and 2) have a reliable way to note that your code is currently running so another copy doesn't start. This is for firing your automatic favorite conversions, isn't it? - 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. |
#6
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
I guess there is no way to achieve this if there is no UI loaded on the server... Dirk |
#7
|
|||
|
|||
Quote:
Dirk |
#8
|
||||
|
||||
Dirk, there are some other pluses and minuses.
The code would be available for any STV. I'm all for that, I'm a firm believer that different STVs should provide different form rather than different function. Once it's out of the STV, would there only be the big binary control? (Shut down server, edit Sage.Properties, Start Server) The STVi hook issue is something that interests me. How am I supposed to take advantage of your great code? The way it is at the moment, I can steal your code with ease and make additions to it. I have to win the laziness competition I'll leave it to you to determine which are the pluses and minuses. John |
#9
|
||||
|
||||
Quote:
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#10
|
|||
|
|||
Quote:
Dirk |
#11
|
|||
|
|||
Quote:
Dirk |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|