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
  #141  
Old 05-27-2008, 07:27 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Are the other api-dependant classes done the same way? Here's how I create the other objects I use...

Code:
        sageApiMediaPlayer = new MediaPlayerAPI(sageApi);
        sageApiMediaFile = new MediaFileAPI(sageApi);
        sageApiAiring = new AiringAPI(sageApi);
        sageApiShow = new ShowAPI(sageApi);
        sageApiGlobal = sageApi.global;   
        sageApiUtility = new Utility(sageApi);
Global is the only one I don't instantiate now.
Reply With Quote
  #142  
Old 07-01-2008, 07:18 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
First of all, thanks for such a great tool, it makes development so much easier!

If I want to sort a list of channels by Channel number, I simply use:

allChannels = allChannels.Sort(false, "GetChannelNumber");

that's fine. Now if instead I want to do it for the Channel number on a lineup, I need to pass that lineup as parameter to the sorting method, according to the Sage API it should be possible to use:

allChannels = allChannels.Sort(false, "GetChannelNumberForLineup", lineup);

unfortunately that overloading has not been implemented, any chance you could add it? Of course the same applies for SortLexical and not only for the channels, but so far that's the only one I really need...


EDIT: I ended up sorting the resulting collection elsewhere, but I still think it would be a nice addition.

Last edited by Fonceur; 07-02-2008 at 09:31 AM.
Reply With Quote
  #143  
Old 07-08-2008, 06:07 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Plugin skeleton not working

Hi Greg,

I created the following minimal plugin class:

Code:
public class Plugin implements StudioPlugin {

    private StudioAPI api;

    public Plugin(StudioAPI api) {
        this.api = api;
    }
    
    public JMenu GetContextMenu() {
        return null;
    }

    public JMenu GetTopMenu() {
        
        JMenu menu = new JMenu("Test");
        JMenuItem item = new JMenuItem("Test...");
        
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            }
        });
        
        menu.add(item);

        return menu;
    }
}
The plugin shows up in the "Manage..." dialog, but after I enable it it still doesn't show up in the menu bar. There's probably something obvious I am missing, but what is it ?

Thanks,
Dirk
Reply With Quote
  #144  
Old 07-08-2008, 06:13 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Never mind, I should have looked at the debug log before posting...

Turns out I used gkusnick.sagetv.api.StudioAPI instead of tv.sage.StudioAPI


Dirk
Reply With Quote
  #145  
Old 07-19-2008, 07:32 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
According to the Sage API, airing.Record() is not supposed to take any arguments, yet the Studio tools expect a StartTime and StopTime, just like the SetRecordingTimes... Sure, I can always use airing.Record(airing.GetScheduleStartTime(), airing.GetScheduleEndTime()), but this is a bit redundant and duplicates the other method anyway...
Reply With Quote
  #146  
Old 07-19-2008, 08:04 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
The API wrappers are derived automatically from the online docs, so if it's expecting extra arguments, there must at some point have been a version of the docs that erroneously showed it taking those arguments.

I'm out of town right now and away from my Sage system, but I'll try to get a refresh of the wrapper functions up sometime in the not too distant future.

Regarding the Sort question, I'm to not too eager to add explicit overloads for every conceivable flavor of Sort, but I can take a look at how hard it might be to pass through any extra arguments in a generic fashion.
__________________
-- Greg
Reply With Quote
  #147  
Old 07-19-2008, 09:14 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by GKusnick View Post
I'm out of town right now and away from my Sage system, but I'll try to get a refresh of the wrapper functions up sometime in the not too distant future.
OK, thanks. I just confirmed that indeed it doesn't work, the log reads: "Called Seeker.Record(null) hostname=..." and nothing happened. By replacing Record with SetRecordingTimes (which does take those 2 parameters), all worked fine.

Quote:
Regarding the Sort question, I'm to not too eager to add explicit overloads for every conceivable flavor of Sort
As I said, it's not a big deal, I simply sorted in my own collection after...
Reply With Quote
  #148  
Old 09-01-2008, 08:38 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
I am trying to loop over the Playlist content and cast the resulting objects appropriately, but it's not working using either cast method that comes to mind...

Code:
Object obj = null;
AiringAPI.Airing airing = null;

for (int i = 0; i < playlist.GetNumberOfPlaylistItems(); i++)
{
  obj = playlist.GetPlayListItemAt(i);
  if (playlist.GetPlayListItemTypeAt(i).equalsIgnoreCase("Airing"))
  {
     airing = AiringAPI.Airing.class.cast(obj);
     airing = (AiringAPI.Airing) obj;
  }
}
They are getting identified correctly has Airing objects (which matches obj.ToString() ), but I either get a NullPointer exception or a ClassCastException... Am I missing something obvious?

Technically I can extract the information that I want through obj.ToString() and GetPlayListItemTypeAt, but I'd rather use the proper way...
__________________
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
Reply With Quote
  #149  
Old 09-01-2008, 10:02 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
For API functions that return generic Objects, the wrapper functions just return the raw, unwrapped object, since they don't know what type to wrap them with. You can't cast those unwrapped objects to wrapped objects; you have to call the appropriate Wrap function.

(In C++ it would be possible to overload the cast operator to do the wrapping automatically. But that feature was deliberately omitted from Java, so you must use the explicit Wrap methods.)
__________________
-- Greg
Reply With Quote
  #150  
Old 09-01-2008, 10:50 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by GKusnick View Post
You can't cast those unwrapped objects to wrapped objects; you have to call the appropriate Wrap function.
OK, thanks! That did it.
__________________
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
Reply With Quote
  #151  
Old 09-10-2008, 08:09 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I've uploaded V0.6 of these tools to the download page. Highlights of this release include:

* API wrappers have been regenerated from the V6.4 API docs.

* Hotkeys defined via Studio.hotkeys should now work properly on right-click context menu commands.

* Fonceur's Sort wish has been granted; all type-specific Sort and Filter methods now accept extra arguments and pass them through to the underlying APIs.

* GetWidgetPath() and GetWidgetFromPath() can now make use of widget UIDs as path roots (so you needn't specify the full path all the way back to menu level). Note that GetWidgetPath() will ignore locally created UIDs (i.e. those matching the UID prefix defined in your instance of Studio) and look for a widget with a non-local UID to root the path, on the theory that the paths will be more universally robust that way.

As a consequence of this last change, reference paths generated by Export As STVI also use UIDs if possible. So STVIs generated by this method should be much more robust than previously. It's worth noting that Export As STVI has not been made entirely obsolete by the new built-in Generate STVI function, since that function does not support sharing of implicitly created hooks and themes among multiple STVIs, as Export As STVI does.
__________________
-- Greg
Reply With Quote
  #152  
Old 09-10-2008, 09:03 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by GKusnick View Post
* Hotkeys defined via Studio.hotkeys should now work properly on right-click context menu commands.
Thanks!

Now I just need to memorize the keys I've assigned...

- 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
  #153  
Old 12-30-2008, 04:47 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Quote:
Originally Posted by GKusnick View Post
* Fonceur's Sort wish has been granted; all type-specific Sort and Filter methods now accept extra arguments and pass them through to the underlying APIs.
This must be what's messing me up..I get an exception now when calling Sort Lexical.

The API doc doesn't explain this change, and the 3rd parameter in the call doesn't make much sense:

public AiringAPI.List SortLexical(boolean Descending,
String SortByMethod,
Object... rgargExtra)

Can you explain what the 3rd parameter is, or at least, how I would use this function again like I did before, which was to sort based on airing times? Do I just pass a "null" in for the 3rd parameter?

thanks
Reply With Quote
  #154  
Old 12-30-2008, 06:56 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, it's working now just by sending in a new Object() for the 3rd parameter. But it'd still be helpful having something in the docs about what that 3rd parameter is for. I know Fonc knows, but the rest of us....
Reply With Quote
  #155  
Old 12-30-2008, 09:00 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
The third formal is just a placeholder for the variable-length list of optional extra arguments as described in the SageTV API docs. (If you're not familier with the ... notation, see "Arbitrary Number of Arguments".) You're not obliged to pass anything in that position; i.e. you should be able to pass just two arguments, and the third will default to a zero-length array (assuming you're calling it from Java code). If that's not working, it might be helpful to know what your code looks like and what exception you're getting when you run it.
__________________
-- Greg
Reply With Quote
  #156  
Old 12-30-2008, 11:17 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
I think I was accidentally referencing 2 of your .jars, and older and a newer. Once I got rid of the older reference, it now accepts just 2 args.

thanks!
Reply With Quote
  #157  
Old 02-01-2009, 10:50 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
No API call to delete a favourite

There is no method to delete a favourite. I suspect this is a result of there being no such method documented in the SageTV API docs (that I can find)? Yet, such a method must exist somewhere in the API as favs can obviously be deleted.
__________________
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...
Reply With Quote
  #158  
Old 02-01-2009, 12:03 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
You can remove a Favorite via RemoveFavorite(). Not sure why it seems to be missing from the docs, but example usage is in the default STV.

- 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
  #159  
Old 02-01-2009, 12:58 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
If you need to do it from Java with a wrapped Favorite object, this should work until the docs are fixed and a new set of wrappers generated:

Code:
sage.SageTV.apiUI(context, "RemoveFavorite", 
  new Object[] {api.favoriteApi.Unwrap(fav)});
__________________
-- Greg
Reply With Quote
  #160  
Old 02-02-2009, 11:49 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by Opus4 View Post
You can remove a Favorite via RemoveFavorite(). Not sure why it seems to be missing from the docs, but example usage is in the default STV.

- Andy
Quote:
Originally Posted by GKusnick View Post
If you need to do it from Java with a wrapped Favorite object, this should work until the docs are fixed and a new set of wrappers generated:

Code:
sage.SageTV.apiUI(context, "RemoveFavorite", 
  new Object[] {api.favoriteApi.Unwrap(fav)});
Yeah, I ended up tracing through STVs to find out how it was done. Then unwrapped the fav object in my Java code to call the RemoveFavorite API call in my code. It works, I suspect the API docs will be updated properly at some point so GKusnick's API can then be updated?
__________________
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...
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


All times are GMT -6. The time now is 09:46 AM.


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