|
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
|
||||
|
||||
Library: Remote APIs for SageTV
Wiki | Download | Project Site | Http/Rest Guide
For another project I am continuing to work on, I ended up creating this Sage API Wrapper that also provides Remote Execution of Sage services (RPC) using either Java or Xml capabilities. You can download it here. Features * Remote/Local Java Calls to the Sage Services * REST Services for all SageTV commands (Xml over Http) * Returns complete sage objects and lists in either Xml or Json format * Can return results in the SageXmlWriter format the Niel's Web Server users * Publish your own remote services using server side javascript * Access Media artifacts, such as posters, backgrounds, etc, (requires phoenix apis) What can you do with this Api? Using the Java API, you can write java code that runs outside the main sage server. ie, if you wanted to write a script that finds all matched tv shows and then deletes them, you can do that without needing to run that code inside SageTV Using the Xml API, you can make requests from a browser and execute sage calls, or get back server information, using nothing more than javascript in a browser. Documentation You can read more about from the download site or the project site. Use this Thread to discuss the library, etc.
__________________
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 Last edited by stuckless; 05-21-2009 at 05:24 PM. Reason: Added More Info |
#2
|
|||
|
|||
Just saw this before calling it a night so I haven't looked at the details/code yet, but my first question, before I forget, is, do the API calls return strongly typed objects/use strongly typed arguments much like Greg's API?
Your RPC example uses an Object[] where I might expect to see MediaFile[] or MediaFile.List (if using Greg's API as an example). |
#3
|
||||
|
||||
The fundamental difference between this API and Greg's API is that this API does not return Strongly Typed objects. It doesn't create any wrappers or additional objects. It's simply a collection of Static Classes and Methods, as the original Javadoc portrays. If it did provide a Stongly typed set of object, then I'd really see no point in creating it, Since Greg's API does that already.
The only way to do Strongly Typed objects for Sage's API, is to do as Greg's API did, which is create an Object instance for each Sage object, because Sage does not export a usable type for their objects (they obfuscate). While typed objects makes for a better object structure, it does lead some object overhead (in this case), which I was trying to avoid for the purposes of RPC. Typed objects (in this case) would also require marhaling and unmarhalling even when used in embedded mode. The RPC api does mashall and unmarshall in RPC mode, but in embedded mode, it does not require it, which should make it slightly more efficient. So, instead of using something like... Code:
media.getTitle() Code:
MediaFileAPI.GetTitle(media)
__________________
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 Last edited by stuckless; 10-06-2008 at 05:46 AM. |
#4
|
||||
|
||||
I got a chance to look over your source code. I like your use of the sagex.* package naming. I'm converting over to that myself.
Have you seen the Jetty plugin I created? Any number of HTTP-based applications can be deployed in there, so you might take a look at that as an option for the server side. It can provide security as well as allow multiple apps running on the same port. That said, I like your mini httpd for its simplicity and some people may want the option of using it if that's the only HTTP app they're using. Another benefit of Jetty is it should also provide each app with its own class loader, although I haven't tested it. There have been problems in the past with different plugins using different versions of the same jar file. This should reduce those conflicts for apps deployed in Jetty. Anyway, nice work on the RPC API
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#5
|
||||
|
||||
There is a related RMI plugin, but it doesn't look it's gone anywhere in a few years and I don't even see a download. I thought it was worth linking to it from here, though.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#6
|
||||
|
||||
Quote:
Quote:
I did seriously look as using jetty, and I also looked at the tiny web server that nielm uses... but in the end, both were overkill in terms of dependencies, and configuration. And to be honest, the reason I created the API was so that I could start embedding less into Sage and more into an external server process Thanks for your feedback.
__________________
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 see on the project page that your end goal is to export an XML web service - just wanted to mark myself down as looking forward to that. As a .NET programmer who has just never managed to find the time to get into Java, I'd love to finally have an easy way to access the Sage API.
|
#8
|
||||
|
||||
Code:
I see on the project page that your end goal is to export an XML web service
__________________
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
|
||||
|
||||
I just released the Xml over Http api for SageTV... See the Wiki for more information on how to make Sage Http calls. Checkout the Xml Rpc Guide as well.
The Xml Rpc API has not been well tested. So if you encounter issues, then please add bugs to the project bug page, or post a note in this thread. The xml rpc is basically a set of rest service that return xml responses. The complete Sage API is exposed as Rest services, but not all aspects of the API lends itself well to rpc services, so don't expect to be able to do everything over http. But, if all you need is to do things things like refresh your media library, so see what tuners you have installed, then you can do calls like this... Code:
http://sageserver:8080/sagex/rpcXml/CaptureDeviceAPI/GetCaptureDevices Code:
<response> <header> </header> <body> <array size="2"> <value index="0">adapter0</value> <value index="1">video0</value> </array> </body> </response> Good luck, and if you have issue, then I'll try my best to help.
__________________
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 Last edited by stuckless; 10-13-2008 at 03:50 PM. |
#10
|
||||
|
||||
I just released a new version of the Sage RPC API. This relase now uses Nielm's webserver instead of it's own micro server. Please refere to the wiki for installation instructions.
I decided to follow jreichen's advice and use an existing server. Nielm's Web Server was easy to integrate with, just add an entry to the servlets.properties. I'm currently looking at providing an integration with Jreichen's Jetty Plugin as well. This new release also adds thumbnail support via a servlet call. ie, you can request the thumbnail, as an image url, for a given media file entry.
__________________
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 |
#11
|
||||
|
||||
On the Jetty plugin wiki, I briefly mention the BeanShell servlet. It accepts BeanShell code (basically Java) and interprets it, so you could write a script to do several operations at once and submit it to the supplied servlet, or a custom servlet, possibly via RPC wrappers. It may also be possible to do the same with other JVM-compatible scripting languages (e.g. Groovy).
That would be one more possibility for remotely executing SageTV code. I attached an example zip that can be extracted to the SageTV folder if you already have the Jetty plugin installed.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#12
|
|||
|
|||
I am thinking about writing an iPhone application leveraging the REST services aspect. I have a few questions about the servlet available.
1) Does it support authentication? 2) Does it support SSL? 3) Is it a capable streaming server? 4) Can it be proxied through a server (Apache/Lighttpd) to enable support of the above? (When proxying nielm's webserver through Apache, IIRC there are issues with streaming files esp. when SSL is used) Thanks, B
__________________
Running SageTV on unRAID via Docker Tuning handled by HDHR3-6CC-3X2 using OpenDCT |
#13
|
|||||
|
|||||
Quote:
Quote:
Quote:
Quote:
Just a note about a streaming and ssl. If you are thinking of using ssl, I would still NOT stream media over ssl. Encrypting a mediafile would be intense, and I can't immagine that you'd need/want to do it. So I would use ssl for authentication, get, but stream all media over http. (personal oppinion) Quote:
If you are simply looking to do url forwarding/proxing, then I would think it would work ok for most calls, but the streaming apis may not work... I haven't tested this for myself.... since in my testing, I'm just running inside nielm's server and accessing it directly.
__________________
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 |
#14
|
||||
|
||||
Quote:
Quote:
Quote:
There is also a thread about reverse proxy and the web servers. I think jhh had pretty good luck, but his Apache was on the same machine as Sage. I tried it with Apache on a different machine and couldn't quite get it working.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#15
|
||||
|
||||
Quote:
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#16
|
||||
|
||||
Hi Sean,
I have been playing with your SageTVApi library and testing a few concepts that I would like to develop further. I ran into one problem, and I'm not sure if it is a problem in the library or if I am not using the API correctly. Basically any methods I call attempting to get a Widget object using the WidgetApi all fail. Here is one simple example: Code:
System.out.println("Widget: " + WidgetAPI.GetCurrentSTVFile()); Widget: nullAny ideas or pointers? Ultimately I am trying to get a menu widget and execute it to display the menu on screen. i.e.: Code:
Object widget = sagex.api.WidgetAPI.GetWidgetSymbol("CDSWT-46001"); sagex.api.WidgetAPI.ExecuteWidgetChain(widget); sagex.api.Global.GetUIContextNames() I am using your API ver: "sagex.api-6.4.8-1.jar" in under the remoting option (running from separate JVM on same computer as Sage) Thanks!
__________________
Server Hardware: Intel Core 2 Quad Q6700 2.66GHz CPU, 4GB DDR2 RAM, NVIDIA nForce 780i SLI Motherboard, GeForce 8600 GT, Seagate Barracuda 7200.11 2.5TB Operating System: Windows XP Professional HTPC/DVR Software: SageTV 7 Capture Devices: 2 @ Hauppauge HD-PVR (1212), Hauppauge WinTV-HVR-1600 ATSC/QAM, HD Homerun Media Extenders: 2 @ Sage HD100 & 1 @ Sage HD200 Signals/Providers: AT&T UVerse, OTA ATSC Set-Top-Box: 2 @ Motorola Box VIP 1200 Last edited by shadeblue.com; 11-04-2008 at 01:26 AM. |
#17
|
||||
|
||||
I have put some thought into how to transparently handle the "context" problem. Initially, I didn't need to use the context, so it got put on the back burner, but I'll spend some time and try to come up with something.
My initial thoughts are along these lines.... 1. for each generated method, generate a second method that also can accept a context parameter, so WidgetAPI would include a method ExecuteWIdgetChain(widget) and ExecuteWidgetChain(widget, context). 2. add a theadlocal variable to generated class, so that you can set the context before executing the method. So, when you call ExecuteWidgetChain, you'd have to set the context first, so something like this... Code:
sagex.api.WidgetAPI.SetContext(context); sagex.api.WidgetAPI.ExecuteWidgetChain(widget); sagex.api.WidgetAPI.SetContext(null); 3. Create a static list of "context" enabled fields and modify the generator to ONLY create context aware methods for methods that can accept a context... Any thoughts?
__________________
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 |
#18
|
||||
|
||||
This is where wrapper objects come in handy, because you can wrap the context up once when you instantiate the API object and not have to worry about it again. I understand your reasons for wanting to stick with static methods only, but the price you pay for that is pushing the burden of keeping track of instance data (like UI context) back onto the caller.
And by the way, shadeblue, you want FindWidgetBySymbol instead of GetWidgetSymbol, and LaunchMenuWidget instead of ExecuteWidgetChain.
__________________
-- Greg |
#19
|
||||
|
||||
Quote:
So I guess I could generate a set of wrapper objects to fix the problem
__________________
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 |
#20
|
||||
|
||||
Quote:
Thank you for the correction. I knew the 'FindWidgetBySymbol' was correct, I must have copied it wrong when I was creating the forum post. I must have missed 'LaunchMenuWidget', I did not know that was the correct call. Again, Thank You! shadeBlue
__________________
Server Hardware: Intel Core 2 Quad Q6700 2.66GHz CPU, 4GB DDR2 RAM, NVIDIA nForce 780i SLI Motherboard, GeForce 8600 GT, Seagate Barracuda 7200.11 2.5TB Operating System: Windows XP Professional HTPC/DVR Software: SageTV 7 Capture Devices: 2 @ Hauppauge HD-PVR (1212), Hauppauge WinTV-HVR-1600 ATSC/QAM, HD Homerun Media Extenders: 2 @ Sage HD100 & 1 @ Sage HD200 Signals/Providers: AT&T UVerse, OTA ATSC Set-Top-Box: 2 @ Motorola Box VIP 1200 |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hauppauge Remote Issue | yacht_boy | Hardware Support | 4 | 05-01-2008 09:25 PM |
MCE remote transmitting keypresses twice | arnabbiswas | Hardware Support | 1 | 02-22-2007 10:55 AM |
MCE Remote not work fully with Placeshifter | devinteske | SageTV Placeshifter | 5 | 02-08-2007 11:45 PM |
Harmony Remote IR Reciever Help | brundag5 | Hardware Support | 2 | 01-13-2007 09:08 PM |
How to get SageTV to release focus to NVDVD for remote | IncredibleHat | SageTV Software | 4 | 07-06-2006 07:47 AM |