SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2007, 10:47 AM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
access SageAPI from standalone application

is it possible to access the sageAPI from a standalone java application? I'm looking to write a standalone application that would replace sage's front-end.
Reply With Quote
  #2  
Old 02-20-2007, 02:08 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Short answer is no. The API is accessible only from classes running within the SageTV (or SageTVClient) process.

What you could do is write a class that runs within SageTVService and listens on a TCP port for API requests that it then executes. Essentially writing your own RCP wrapper for the Sage API. Then you could make API calls remotely from any process on any machine. (This is more or less what Niel's webserver does.) You could use this to access the wiz.bin database and schedule recordings and such, but you'd have to provide your own media playback engine.

I'm curious, though, how replacing SageTVClient with a homebrew frontend app would offer a significantly different user experience than running SageTVClient with a homebrew STV.
__________________
-- Greg
Reply With Quote
  #3  
Old 02-20-2007, 02:31 PM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
Quote:
Originally Posted by GKusnick
I'm curious, though, how replacing SageTVClient with a homebrew frontend app would offer a significantly different user experience than running SageTVClient with a homebrew STV.
I was thinking more in the line of a Mouse interface than just an STV. plus Studio is a bit of a pain to work with from a programmer's standpoint. For instance I've been trying to create an animated main menu recently and just to get that running its tedious to say the least. Not to mention you can't start your own threads and run your code... unless i'm missing something.
Reply With Quote
  #4  
Old 02-20-2007, 02:32 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by matrix35
I was thinking more in the line of a Mouse interface than just an STV. plus Studio is a bit of a pain to work with from a programmer's standpoint. For instance I've been trying to create an animated main menu recently and just to get that running its tedious to say the least. Not to mention you can't start your own threads and run your code... unless i'm missing something.
The Fork() command creates a new thread in studio.
Reply With Quote
  #5  
Old 02-20-2007, 02:39 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
... or call into your own class to start new threads in java


Dirk
Reply With Quote
  #6  
Old 02-20-2007, 02:52 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by matrix35
I was thinking more in the line of a Mouse interface than just an STV.
Studio provides hooks for creating clickable and draggable UI elements. Plus you can always drop into Java for more sophisticated UI interactions. The Studio window itself is an example of a full-fledged Swing UI running within Sage.
__________________
-- Greg
Reply With Quote
  #7  
Old 02-20-2007, 03:56 PM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
Thanks for the fork info, didn't know that existed.

as for calling my own class, what packages should I then import to get my class compiled. If for instance I want a widget instance inside of my java code (to change position+transparency), can that be done?

is there a tutorial written somewhere on how to get started writing external modules and how to call on them?
Reply With Quote
  #8  
Old 02-20-2007, 06:19 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Chapter 9 of the Studio manual has sections on "Using Java code" and "Calling SageTV API methods from Java". You might also want to look at my Studio Tools package (see the sticky thread at the top of the forum), which includes strongly-typed wrapper functions for the SageTV API.

You can use the WidgetAPI to manipulate widgets from Java code. My Tools package does this to implement custom editing commands in Studio, and you might also want to do things like this at STVI import time to alter widgets in the standard STV. However using the WidgetAPI to change widget properties on the fly as part of normal UI execution is probably not a good idea, since it causes Sage to think the STV has been edited and leads to spurious "Do you want to save changes?" prompts.

A better solution is to program the widgets themselves with dynamic property expressions (including calls to Java functions if you like) instead of fixed property values. This is covered in the "General Widget Properties" section of Chapter 3.
__________________
-- Greg
Reply With Quote
  #9  
Old 02-20-2007, 06:29 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Forgot to mention that there's source code in my Tools package if you want to see how it's done. Niel has also published the source to many of his plugins.
__________________
-- Greg
Reply With Quote
  #10  
Old 02-20-2007, 08:12 PM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
thanks Greg, i'll take a look at them.

cheers,
Reply With Quote
  #11  
Old 02-21-2007, 03:23 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
I am also not sure what you are trying to do...

Do you want to create a pure-java STV-independant GUI that calls the Sage API to get program info, schedule recordings, etc? If so have a look at my webserver and Gkusnick's java wrappers for Sage API functions. These call studio API's from Java, and are started by the sage core on startup.

Do you want to create a new STV (Sage User Interface) with Sage widgets, that uses Java as 'helper' code for advanced data manipulation? If so look at several of my STVI plugins (rss news, dynamic menu, IMDB) -- these call java code from Studio.

Either way there should be some example code to work with.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #12  
Old 02-21-2007, 10:45 AM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
Quote:
Do you want to create a new STV (Sage User Interface) with Sage widgets, that uses Java as 'helper' code for advanced data manipulation? If so look at several of my STVI plugins (rss news, dynamic menu, IMDB) -- these call java code from Studio.
thanks nielm I was gonna do that I've read the sticky Jeff posted on how to integrate C# app into sage and thought right away of your plugins. I was scrolling through them last night.

My original post did include both of those options (too many ideas, so much brain space). I was toying with either create a new Sage front-end or create a lib to ease widget animations/transitions. All I wanted to do is customize the interface for it to be more dynamic (i decided to do something about http://forums.sagetv.com/forums/showthread.php?t=23369), so I believe creating a lib for widget animations/transitions would be my best option.
Reply With Quote
  #13  
Old 02-21-2007, 11:57 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
The V6 Music Browser includes several examples of scrolling animation. I've used Studio to implement zooming and fading items, and lap-dissolve panel transitions.

What sort of animations did you have in mind? Maybe they're already possible in Studio and you just don't know it. Remember that most widget properties, including position, size, color, transparency, etc., can be set to dynamic expressions that can include time-varying terms.
__________________
-- Greg
Reply With Quote
  #14  
Old 02-21-2007, 01:48 PM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
Quote:
Originally Posted by GKusnick
The V6 Music Browser includes several examples of scrolling animation. I've used Studio to implement zooming and fading items, and lap-dissolve panel transitions.

What sort of animations did you have in mind? Maybe they're already possible in Studio and you just don't know it. Remember that most widget properties, including position, size, color, transparency, etc., can be set to dynamic expressions that can include time-varying terms.
I was thinking of transforming key SageMC menus into either vertical or horizontal ribbon scrollers where the selected item will be full opacity and rest of menu is gradually transparent. I've already done this to the Main Menu (when MCE style is selected) here: http://forums.sagetv.com/forums/atta...3&d=1171684349
the menu scrolls (up/down) while increasing/decreasing the opacity and position.

I've used the RenderStarted hook to increment the position/transparency but I'm not very happy with the way it's implemented. It requires 3 attributes + up/down listeners modification + RenderStarted hooks + Refresh calls into each menu. Not to mention the dynamic attributes for each menuitem manually inputed.

I was hoping to offloaded this manual operation into a class.

p.s. what do yo mean by "time-varying terms"

Last edited by matrix35; 02-21-2007 at 01:50 PM.
Reply With Quote
  #15  
Old 02-21-2007, 02:06 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by matrix35
... I've used the RenderStarted hook to increment the position/transparency...
BTW: look into the LayoutStarted hook. There can be certain settings that get changed during the RenderStarted hook which won't afect things until the next redraw, while changes made in the LayoutStarted hook should affect the current refresh. That was the whole purpose of adding that hook.

- 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.
Reply With Quote
  #16  
Old 02-21-2007, 02:27 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
By "time-varying terms" I mean expressions that include time in their calculations. Instead of counting Render cycles, set your property expressions to calculate position and transparency based on the elapsed time in milliseconds since the item was selected (or whatever).

Similarly, you shouldn't need to be calling Refresh for animations. Use the Animation property of the widget to schedule regular redraws, or to redraw continuously while some boolean condition is true.

And if you find yourself typing in the same property expressions in widget after widget, consider using a theme to abtract those common properties for widgets of that type. Themes are to widgets as classes are to Java objects.

If you want to use Java functions for some of these calculations, there's nothing wrong with that. Property expressions can include Java calls. But you generally want to keep the widget machinery in the driver's seat and restrict the Java code to pure calculation, i.e. value-returning functions without side-effects, rather than having the Java code try to actively trigger refresh cycles or alter widget properties directly.
__________________
-- Greg
Reply With Quote
  #17  
Old 02-21-2007, 03:09 PM
matrix35 matrix35 is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 108
wow , thanks Greg, Andy that clears up alot of things... for instance the update of the menu is MUCH better and more fluid since I've used LayoutStarted hook and removed the Refresh() command. I'll be looking into the studio manual in more detail and take more advantage of the Animation attribute. will post back with questions if there are any... well i kinda feel silly for not looking into the manual first for answers
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to access remote UNC paths using service w\ v6.0.18 MeInMaui SageTV Software 7 12-30-2006 10:18 AM
sage tv won't work when java access bridge is installed, arg!!! (hairpulling!!) whocrazy SageTV Software 7 11-20-2006 12:16 AM
Cannot access SageMC folders Alwayslearnin SageMC Custom Interface 1 11-08-2006 10:44 PM
Access .NET (dll) From Studio? deria SageTV Studio 5 11-04-2005 01:55 AM
BDA Tuner Test Application Stealth1971 Hardware Support 17 04-19-2005 10:50 AM


All times are GMT -6. The time now is 04:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.