|
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
|
|||
|
|||
Sage API Imports....?
As an experience Java developer (but new Sage Developer), I feel like this might be a really stupid question.. But where exactly are the libraries listed here http://download.sage.tv/api/?
I have added sage.jar to my path - but I don't see a "sage.api" package? I looked for other likely jars in the sage dir.. I was looking to call a method in sage.api.Global that returned a sage.MetaImage. I can't seem to find Global or MetaImage. |
#2
|
|||
|
|||
You need to call it per the instructions at the bottom of that
Code:
public static Object api(String methodName, Object[] methodArgs) throws java.lang.reflect.InvocationTargetException; Also method name is simply "GetLogo" If that is the call you are wanting to make. or if you want to use the UIContext when calling it which I think you would in this case Code:
public static Object apiUI(String uiContextName, String methodName, Object[] methodArgs) throws java.lang.reflect.InvocationTargetException; I would also recommend looking at the sagex api by stuckless it is object oriented and really friendly/easy to use as it builds the object[] so you don't have to each time manually. Last edited by PLUCKYHD; 10-15-2010 at 10:04 AM. |
#3
|
||||
|
||||
You can also look at using GKusnick's Studio Tools...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2 TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad |
#4
|
|||
|
|||
Yeah sorry I forget about his sometimes but he has some good api wrappers as well.
|
#5
|
||||
|
||||
Thanks for the plug. To clarify a bit, my Studio Tools plugin adds some searching and editing commands to the Studio menus. My Tools Library plugin contains the API wrappers. So if all you want are the wrappers, you don't need the Tools, just the Library. (Although I recommend the Tools as well if you're doing serious Studio work.)
__________________
-- Greg |
#6
|
|||
|
|||
Quote:
There must be an architectural reason for it - but it just seems crazy. So - I call the method, I get back an Object... How do I cast it to a MetaImage so I can work with it - since I can't seem to find the MetaImage class to import either? Quote:
|
#7
|
|||
|
|||
Quote:
Code:
Object = currmediaobject Class currclass = crrmediaobject.getClass() As I like you couldn't see anway to import the MediaObject class of sagetv. Hopefully someone else knows a better way |
#8
|
|||
|
|||
of course I just realized my method wouldn't help you much...sorry
|
#9
|
||||
|
||||
Quote:
Quote:
I haven't used the sagex wrappers, but mine cast the returned objects to the appropriate types in cases where those types are not obfuscated.
__________________
-- Greg |
#10
|
||||
|
||||
Another vote for the sagex wrappers....
__________________
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
|
|||
|
|||
I live and die by GKusnick's wrappers! Strongly typed API calls save massive headaches with typos, etc. I've never actually written plugin code with anything else. Just recently I've started using Stuckless' remote API wrappers as some of my current work involved interacting with the Sage server outside of its JVM process, which means GKusnick's wrappers aren't an option. If you're writing code that will only live inside the Sage JVM then I recommend GKusnick's wrappers. If you're writing code that will run outside the Sage JVM then Stuckless' wrappers are the answer. Both very good, both very easy to use. I give both two thumbs up! Just a slight edge to GKusnick's because I really love the strongly typed aspect of them.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#12
|
||||
|
||||
When I wrote the sagex-apis, I needed a set of apis that suited my development process. I like to code, debug and run my code all from eclipse, and that's not something I could do using the native sage calls or greg's wrappers. sagex-apis enabled me to live in eclipse 100% of the time, and I only deploy and restart my sage server when I'm about to deploy my code. This ability to run code directly from eclipse has saved me litterally 100s of hours.
When I first started out with Sage, I used Greg's wrappers as well. They are a great alternative to simply calling the sage apis from java. I didn't create a set of statically typed apis because I didn't want to simply recreate what greg had done, so I went route of creating the APIs to mirror how SageTV documented them. It would be interesting, if greg's apis could somehow use the sagex apis to make it's calls, rather than the core sagetv call. This would give the ability to use Greg's apis in development and remotely. I actually contacted greg about doing just that. At the time, he wasn't interested, but he did say that if the development community asked for it, then he might consider it. Obviously it would have to be done in such as way that his apis do not depend on mine, but rather, if mine are present, then you have to option to use either my api or the native api when invoking sagetv calls. I have since looked at creating a set of statically typed API calls for sagex as well, and it's not hard to do, but it's not high on my priority list, at the moment.
__________________
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
|
|||
|
|||
I never have luck running code direct from netbeans using the sagex API. Te console always says something like we must be running remotely in the print out but it never seems to work. Am I missing something I need to be doing?
|
#14
|
||||
|
||||
Quote:
To start, you'll need do a simply test program... Code:
package test.junit; import sagex.api.Global; public class TestRemote { public static void main(String args[]) { System.out.println("Server: " + Global.GetServerAddress()); } } Code:
INFO - Configured Root Logger LOG4J: Configured Root Logger INFO - Configured Logging for: sagex-api using file: sagex-api.log4j.properties LOG4J: Configured Logging for: sagex-api using file: sagex-api.log4j.properties Embedded SageAPI is not functional. We are most likely running remotely. Adding Remote Server: seans-desktop Adding Remote Server: mediaserver Server: seans-desktop Code:
package test.junit; import sagex.SageAPI; import sagex.api.Global; import sagex.remote.rmi.RMISageAPI; public class TestRemote { public static void main(String args[]) { SageAPI.setProvider(new RMISageAPI("mediaserver")); System.out.println("Server: " + Global.GetServerAddress()); } } Code:
then the output should look like... INFO - Configured Root Logger LOG4J: Configured Root Logger INFO - Configured Logging for: sagex-api using file: sagex-api.log4j.properties LOG4J: Configured Logging for: sagex-api using file: sagex-api.log4j.properties Server: mediaserver
__________________
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 |
#15
|
|||
|
|||
Sean:
We need to get together for an afternoon sometime when you have the time to debug the auto discovery code because auto discovery has never worked for me. As it turns out, in the context I've been using the remote APIs, I really want to explicitly set the provider anyways so this issue doesn't affect me. I don't hardcode the ip/port for RMI in my code, it's provided to the external JVM by other means and then I set the provider with that data, but I can also envision plenty of future use cases where I would really want auto discovery to function so I'm more than willing to spend some time digging into it with you. Email me if you want to dig into it sometime.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#16
|
||||
|
||||
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 |
#17
|
|||
|
|||
Quote:
It works remotely now what I life saver. I had it working under v6 long ago and just assumed it was a v7 issue. Thanks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sage API - sagetvmsg.txt - Can API tell if HDPVR Crashed? | personalt | SageTV Customizations | 4 | 08-25-2010 04:56 PM |
Sage V7 All my sage recordings showing up in imports | davey_fl | SageTV Beta Test Software | 4 | 07-06-2010 05:59 PM |
STV Imports: Imports for V3 Updated 20/Aug/2005 | nielm | SageTV Customizations | 186 | 10-30-2005 01:55 PM |
imports, sage service and user management | Gog | SageTV Software | 5 | 01-05-2005 07:28 PM |