|
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
|
|||
|
|||
Custom STV - Access to Placeshifter
I have a quick question about the placeshifter code. I will be living in Germany for the next two years and I have successfully set up a DVB-S card for free to air channels. I also left a server computer at my parents to record cable from the US. Currently I download the shows through a script with PCanywhere.
I downloaded the placeshifter trial and I believe the quality will work for most things I want to do (only a 27" SDTV). My question is, if I purchase the placeshifter license, will I be able to create a custom STV for Sage on my HTPC that will still do the regular HTPC functions for the DVB-S card and local recordings, but that will be able to access the US computer through the placeshifter client without leaving the UI. I guess my main question is, will it be as easy as editing the sage stv, or is there a lot more involved. thanks Josh
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#2
|
||||
|
||||
If I'm understanding the question right, the answer is no. The Placeshifter client is not just an STV skin for the regular SageTV application. It's a completely separate piece of software. So you can't just click a menu item in SageTV running locally and suddenly be in Placeshifter mode talking to a server on the other side of the world without ever leaving the Sage UI. You would have to quit the local UI and start up a placeshifter client instead.
However it wouldn't be hard to customize your local STV to automate that process of switching back and forth between clients. For instance you could write some code in Studio to launch a batch file or script just before quitting. The script would then wait a few seconds before firing up the Placeshifter client, wait in the background for Placeshifter to exit, and then relaunch the regular SageTV UI. Or something along those lines. This would be a good argument for running your local SageTV in service mode, so that closing the UI doesn't interfere with local recording.
__________________
-- Greg |
#3
|
|||
|
|||
Quote:
One other question, Is there a way to skip over the "Connect Screen" in placeshifter, so I can have it automatically hook up to the same server with the same settings each time? That way the script would take me right to the login screen. thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#4
|
||||
|
||||
Quote:
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#5
|
|||
|
|||
Quote:
Thanks for the info. I should have checked back earlier. I already worked out most of the details on my own. I have no problem launching it now from the STV modifications I made. I do see one difference. Does your customizable menus contain special instructions/code that allow the waitforexit argument? Because I can run the code to execute the placeshifter program, but my SageTv server never goes to sleep. Is there additional code I can add either to the ActionWidget properties or the xml file that would mimic your waitforexit=0? thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#6
|
||||
|
||||
How are you with Java
The ExecuteProcess() returns a java.lang.Process object. The Process java object has a waitFor() function, so you could do (untested): Code:
(action) +- SageCommand("Power Off") (action) +- p=ExecuteProcess("SageTVPlaceshifter.exe",null,null,true) (action) +- (action) Fork() (action) +- java_lang_Process_waitFor(p) (action) +- SageCommand("Power On")
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#7
|
|||
|
|||
Quote:
thanks for your help.
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#8
|
|||
|
|||
Nevermind, I still need to learn JAVA but your code helped greatly.
I need to make one change though to make it work the way I wanted. The SageCommand("Power Off") need to be the first child of the ExecuteProcess widget. Then it worked perfectly. I am almost there, one more question for ya... I want to be able to start and stop placeshifter in full screen mode after logging in. Now the starting in full screen mode might not be feasible, but I imaging there could be an internal SageCommand to completely shut down the application (similar to selecting the x in the top of the window when not in full screen mode). I tried "Exit" and "Close", but these didn't do anything. Or is this another hurdle to be accomplished by JAVA? thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#9
|
||||
|
||||
There's no SageCommand() string for Exit, but there is an Exit() function in the API. SageTV API docs, if you haven't found them yet, are here.
Also click here for Java 1.4 API docs, and here for online Java tutorials. I was able to learn everything I needed to know about Java from these, without spending any money on how-to books. (Note, though, that the tutorials are geared toward later versions of Java than the one that installs with Sage.)
__________________
-- Greg |
#10
|
||||
|
||||
Quote:
__________________
-- Greg |
#11
|
||||
|
||||
and I also have an ExitSage plugin (which needs my dynamic menus)...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki Last edited by nielm; 09-02-2006 at 12:38 PM. |
#12
|
|||
|
|||
Quote:
Thanks for all your help. It is working perfectly as of last night. These little exercises have certainly peaked my interest. I am definitely going to devote some time reading through the links you passed along. Maybe one day I'll be able to create some cool imports and customizations.
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#13
|
|||
|
|||
nielm + GKusnick,
One more question for you. The links you were provided were great and I have totally immersed myself. The JavaBeans program was a huge help for debugging my first coding efforts. I am not doing anything in particular, but was just trying to create a parsing program to test importing data into sage. My lack of knowlege deals with the executable part of java from within Sage. I have a program no that works great to open a urlstream to a weather website, and pull out temperature information. Though I have only figured out how to make it work by creating the "public static void main" class and call the class constructers from within the program. Is there anywhere out there that details the method for running the stand alone jar files (whether in sage or not) and calling specific methods? I didn't mean to turn this into a Java thread. I am going to get a Java book anyways since it seems like there is so much you can do with it. thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#14
|
||||
|
||||
I'm not entirely sure I understand the question. P. 137 of the Studio manual describes how to call your Java code from Studio's widget language, if that's what you're asking. You can instantiate arbitrary Java objects and call their methods, using a somewhat klunky syntax.
If you're asking how to run Java code in a separate thread in the background while SageTV executes, there are two ways to do that. You can the Studio API to Fork() a new thread in your widget code, and then call into Java from there. Or you can specify a list of runnable Java classes in the load_at_startup_runnable_classes property in your .properties file to be loaded and started when Sage starts. If you're asking how to write a standalone Java app that can be run from the Windows command prompt or whatever, the Hello World tutorial should cover that.
__________________
-- Greg Last edited by GKusnick; 09-06-2006 at 02:01 PM. |
#15
|
|||
|
|||
Sorry, now that I look at my post it is kind of confusing. My main question is where and how to access my code once it is written. It looks like to me that all applications are distributed in .jar files for sage to access.
Say I have a Java001.jar package with a class querySomething and methods getInfo() and sendInfo(). Can I just compile the jar file and stick it in sage and access the specific methods via Java001_querySomething_getinfo() Also, when you make something run using the java command from the command line you are using a .java file and subsequent class file, but it looks like you need a main class which then starts your code process as soon as you load it from the java command. Is this needed for sage as well? I seem to be doing great at the programming and running things in JavaBeans, I just can't understand the sage interface. thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#16
|
||||
|
||||
The name of your JAR file is not really relevant for calling your code from Sage. What matters is the package declaration at the top of your file. So if your code looks like this:
Code:
package some.package.name; class querySomething { public void getInfo() { } } Code:
+ var = new_some_package_name_querySomething(); + some_package_name_querySomething_getInfo(var); This is assuming you want the getInfo() code to run synchronously in the UI thread, i.e. the UI will be paused and you'll see the spinning Sage icon on screen while your code is thinking. If that's good enough, then you're done.
__________________
-- Greg |
#17
|
|||
|
|||
Exactly the information I was looking for!
I have been trying a couple things without much luck so maybe under your careful eye you can point out my error. I made a simple class that should return a string when the method is called. Here is the code package jbk.projects; public class reportWeather { public String weatherLocation; public String returnName() { weatherLocation = "Stuttgart"; return weatherLocation; } } All I wanted to do was place the name "Stuttgart" in a menu selection to make sure the communication between SageTV and my java code was working before I tackled bigger things. Here is the sage hierarchy: Menu + Menu Panel + Item(Name = "Weather") + Action(jbk_projects_reportWeather_returnName(newWeath)) + Text (untitiled) + Hook (BeforeMenuLoad) + Action(newWeath = new_jbk_projects_reportWeather()) I tried a couple different variations on this theme (like using aVarName = jbk_projects_reportWeather_returnName(newWeather)), with the JAR file compile (through NetBeans) and placed in the SageTV Jars folder. Nothing seems to rename the Item widget. This is tougher than I thought. Kudos to those that can create reliable efficient programs to run in sage. thanks
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
#18
|
|||
|
|||
Quote:
And a tip: code fragments in a post are easier to read if you enclose them in "[code]" tags : Code:
package jbk.projects; public class reportWeather { public String weatherLocation; public String returnName() { weatherLocation = "Stuttgart"; return weatherLocation; } } |
#19
|
||||
|
||||
Quote:
Also, call me old-fashioned, but I like to arrange the widgets in the order they actually execute (i.e. declaration before initialization before use). It makes no difference to the widget evaluator, but I think it makes the logic easier to follow for the human reader. Code:
Menu + Attribute newWeath + Hook (BeforeMenuLoad) + Action(newWeath = new_jbk_projects_reportWeather()) + Menu Panel + Item(Name = "Weather") + Action(jbk_projects_reportWeather_returnName(newWeath)) + Text (untitiled)
__________________
-- Greg |
#20
|
|||
|
|||
Gkunsik,
I did have the beforeMenuLoaded hook under the correct tree, sorry for the confusion as I spaced the text out but didn't realize that it would be compressed back down without HTML formatting. flachbar, That did the trick, my java programming and sageTV are now talking to each other and generally playing nice. I have run into one more formatting question. Once I create the new instance in sage, and I want to reference the new instance but pass along a string argument, how is that written in the action widget? I have tried: Code:
+ Panel (SubMenu) + Action (jbk_projects_reportWeather_getLocator(newWeath, "Stuttgart") + Text (Untilted) Where the java code is public String getLocator(String newLocation){ .... return ...; }
__________________
Server and Media Center - Intel Core Duo 2x2.50 Ghz, Asus P5N7a-VM (Onboard HDMI and Optical Audio), 2GB Ram, Hauppauge HVR-1300, SageTV Beta v7.0.9, nVidia PureVideo decoder |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|