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
  #321  
Old 02-25-2011, 01:03 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by razrsharpe View Post
you should be able to do sagex.api.Global.GetUIContextName() as well... unless stuckless is rerouting that to his own ui context logic....
I pretty much do that now (see the second System.out.println() in my example code) but the problem is that the results change over time.

Argh! My kingdom for a way to set a property in the client's property file
__________________

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.
Reply With Quote
  #322  
Old 02-25-2011, 01:13 PM
JREkiwi's Avatar
JREkiwi JREkiwi is offline
Sage Icon
 
Join Date: Jan 2005
Location: Auckland, New Zealand
Posts: 2,132
Really beyond my understanding, but have you tried sagex.SageAPI.getUIContext() or is that the same as what you're using?

John
Reply With Quote
  #323  
Old 02-25-2011, 01:31 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I pretty much do that now (see the second System.out.println() in my example code) but the problem is that the results change over time.

Argh! My kingdom for a way to set a property in the client's property file
I guess the only 100% reliable way to is pass the context into your api I do that now for only for the Play() api method, because I can risk getting the wrong context.
Reply With Quote
  #324  
Old 02-25-2011, 01:38 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
OK, I'll give that a shot. I've never used the sage API directly, I've always used sagex and to a lesser extend Greg's wrappers. I poked around but could not find any instructions on how to call the API directly.

I did find the API specification here: http://download.sage.tv/api/index.html

But I'm still a novice at Java and can't really figure out how to invoke the methods in Java. Is it as simple as using SageTV.api.("methodNameHere", parm1, parm2)
Yeah, something like that... except i think the params have to be passed as an object array.

Code:
SageTV.api("GetUIContextName", new Object[] {param1, param2})
you can pass null as the object array, if the sage api command doesn't accept a parameter.

Quote:
Originally Posted by Fonceur View Post
Any chance you could simply save the initial value and reuse it, instead of constantly querying for it?
The problem is what do yo use to store/retrieve it? ie, it can't be a static variable since other extenders would end up overwriting it. You could use a ThreadLocal (which is what the sagex api does as well), but that has some issues on its own. GetUIContextName() was never meant to be called outside of the UI, and so , in Java, it may be somewhat unpredictable. I think Jeff has added code to make GetUIContextName() work in Java, but mayber there are still some outstanding issues.
Reply With Quote
  #325  
Old 02-25-2011, 01:47 PM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by stuckless View Post
You could use a ThreadLocal (which is what the sagex api does as well), but that has some issues on its own.
thats what ortus does/did... it works pretty reliably (as near as i can tell anyway jphipps would have to comment on if they have more issues with it bc it works well for my needs but dont use it that much)

Quote:
GetUIContextName() was never meant to be called outside of the UI, and so , in Java, it may be somewhat unpredictable. I think Jeff has added code to make GetUIContextName() work in Java, but mayber there are still some outstanding issues.
yes he did for 7.0... but perhaps there are still issues... you should be able to call Global.GetUIContextName() from java if called from the UI widget chain....
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #326  
Old 02-25-2011, 04:56 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by razrsharpe View Post
... you should be able to call Global.GetUIContextName() from java if called from the UI widget chain....
See my sample code above, I use that method and it does not consistently return the same thing.
__________________

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.
Reply With Quote
  #327  
Old 02-25-2011, 05:20 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
I use uicontext heavily from SMM api and never have any issues.

I use the sagex.api.GetUIContextName() if I just want the name for storing however when passing it as a UIContext in the sagex.api I use the

Code:
new UIContext(sagex.api.GetUIContextName)
I haven't had any issues with SMM using these methods.
Reply With Quote
  #328  
Old 02-25-2011, 06:38 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
I *think* I finally cracked it. I created a this method:

Code:
    public static String getUIProperty(String Prop, String Default) {

        try {
            return (String)SageTV.apiUI((String)SageTV.api("GetUIContextName", new Object[]{}),"GetProperty", new Object[] {Prop, Default});
        } catch (Exception ex) {
            return null;
        }
    }
and so far I think it's working. I'll be doing more testing this weekend.

Plucky - I tried your way and for some reason I just could not get it to work. I'm probably doing something wrong, but I sure can't figure it out.
__________________

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.
Reply With Quote
  #329  
Old 02-25-2011, 08:38 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I *think* I finally cracked it. I created a this method:

Code:
    public static String getUIProperty(String Prop, String Default) {

        try {
            return (String)SageTV.apiUI((String)SageTV.api("GetUIContextName", new Object[]{}),"GetProperty", new Object[] {Prop, Default});
        } catch (Exception ex) {
            return null;
        }
    }
and so far I think it's working. I'll be doing more testing this weekend.

Plucky - I tried your way and for some reason I just could not get it to work. I'm probably doing something wrong, but I sure can't figure it out.
I have a feeling that you'll find that it will suffer the same unpredicable nature... it's doing exactly what the sagex apis is doing... except you are not using sagex apis

Code:
public static java.lang.String GetProperty (UIContext _uicontext,java.lang.String PropertyName, java.lang.String DefaultValue) {
  Object o = sagex.SageAPI.call(_uicontext, "GetProperty", new Object[] {PropertyName,DefaultValue});
  if (o!=null) return (java.lang.String) o;
  return null;
}
sagex.SageAPI.call is a very thin layer on top of the native sage api that is there to allow the sagex apis to be proxied remotely, but when running in embedded mode, it just passes through to the native api.

Code:
public class EmbeddedSageAPIProvider implements ISageAPIProvider {
	public Object callService(String name, Object[] args) throws Exception {
		return sage.SageTV.api(name, args);
	}

	public String toString() {
		return "sage://embedded";
	}

	public Object callService(String context, String name, Object[] args) throws Exception {
	    return sage.SageTV.apiUI(context, name, args);
	}
}
So, while your code is all on one line... it's still doing the exact same thing... Let us know you make out.
Reply With Quote
  #330  
Old 02-26-2011, 07:51 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
I have a feeling that you'll find that it will suffer the same unpredicable nature... it's doing exactly what the sagex apis is doing... except you are not using sagex apis
I thought the same thing, but so far it's working. Of course I haven't really given it a good stress test yet - I'll report back when I have firmer results.

BTW - After using the "raw" SageTV class I appreciate even more the work you and Greg have done to make our lives easier. Thanks!
__________________

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.
Reply With Quote
  #331  
Old 03-12-2011, 11:57 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
There's new 7.1.5 version of the sagex-apis in the repository.

- adds the new apis that were added in 7.1.5 (provided you are are running 7.1.5).
- adds xml/json serialization support for SeriesInfo, Plugins, and Favorites.
- adds support for scaling thumbnails, logos, and album art
Reply With Quote
  #332  
Old 03-14-2011, 09:31 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
I'm running 7.1.5.1 and getting an error when trying this URL: http://192.168.1.10:8080/sagex/api?c...all&3=1&4=true

Code:
Too many args; Your Arg Count: 4; Required Arg Count: 1
I only see 1 GetChannelLogo API in the javadocs and it takes 1 parameter. That doesn't match Sage's 7.1.5 release notes.
__________________
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.

Reply With Quote
  #333  
Old 03-17-2011, 06:36 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
I'm uploading the new API documentation files that have the other one in it. Small typo in the comments that preventing both from showing up.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #334  
Old 03-17-2011, 06:41 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
I then noticed the new AddShow and AddAiringDetailed weren't showing up either....uploaded them again with that fixed too.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #335  
Old 03-18-2011, 09:12 AM
bradvido's Avatar
bradvido bradvido is offline
Sage User
 
Join Date: Nov 2010
Location: MN
Posts: 68
EDIT: updating to 7.1.5 fixed this issue!

I'm using version 7.0.23.3 and it seems the GetTranscodeJobSourceFile is not working as expected:
This:
Code:
http://192.168.88.10:8080/sagex/api?c=GetTranscodeJobSourceFile&1=161
Returns this:
Code:
<?xml version="1.0"?>
<SeriesInfo>
  <SeriesTitle><![CDATA[Law & Order: Special Victims Unit]]></SeriesTitle>
  <SeriesDescription><![CDATA[The detectives that are part of the NYPD's Special Victims Unit investigate crimes of sexual nature. While the focus of the other shows in the ``Law & Order'' franchise largely deal with murder cases, the SVU detectives frequently deal with crimes, such as rapes, in which the victim survives and assists authorities in the investigation. The series features a cast of veteran actors, lead by Christopher Meloni and Mariska Hargitay.]]></SeriesDescription>
  <SeriesCategory><![CDATA[Crime drama]]></SeriesCategory>
  <SeriesSubCategory><![CDATA[]]></SeriesSubCategory>
  <SeriesHistory><![CDATA[]]></SeriesHistory>
  <SeriesPremiereDate><![CDATA[1999-09-20]]></SeriesPremiereDate>
  <SeriesFinaleDate><![CDATA[]]></SeriesFinaleDate>
  <SeriesNetwork><![CDATA[NBC]]></SeriesNetwork>
  <SeriesDayOfWeek><![CDATA[]]></SeriesDayOfWeek>
  <SeriesHourAndMinuteTimeslot><![CDATA[]]></SeriesHourAndMinuteTimeslot>
  <SeriesInfo>
    <SeriesTitle><![CDATA[]]></SeriesTitle>
    <SeriesDescription><![CDATA[]]></SeriesDescription>
    <SeriesCategory><![CDATA[]]></SeriesCategory>
    <SeriesSubCategory><![CDATA[]]></SeriesSubCategory>
    <SeriesHistory><![CDATA[]]></SeriesHistory>
    <SeriesPremiereDate><![CDATA[]]></SeriesPremiereDate>
    <SeriesFinaleDate><![CDATA[]]></SeriesFinaleDate>
    <SeriesNetwork><![CDATA[]]></SeriesNetwork>
    <SeriesDayOfWeek><![CDATA[]]></SeriesDayOfWeek>
    <SeriesHourAndMinuteTimeslot><![CDATA[]]></SeriesHourAndMinuteTimeslot>
    <SeriesImage/>
    <NumberOfCharactersInSeries>0</NumberOfCharactersInSeries>
    <SeriesID><![CDATA[]]></SeriesID>
  </SeriesInfo>
  <NumberOfCharactersInSeries>8</NumberOfCharactersInSeries>
  <SeriesID><![CDATA[316978]]></SeriesID>
</SeriesInfo>
It is returning series info, but the docs say it should be returning a sage.MediaFile...
Perhaps there is a simple change in your code to reference the correct call? I'll try updating to the latest version and see what changes

Thanks for the help!

Last edited by bradvido; 03-18-2011 at 09:19 AM.
Reply With Quote
  #336  
Old 03-18-2011, 10:27 AM
cncb cncb is offline
Sage Icon
 
Join Date: Jul 2006
Posts: 1,271
New channel logos

I noticed that the new channel logos in the beta are not currently showing up with the API.
__________________
-Craig
Reply With Quote
  #337  
Old 03-19-2011, 07:22 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
7.1.5.2 is posted

I've updated the sagex apis to 7.1.5.2. Hopefully this should now include the new apis that were published.
Reply With Quote
  #338  
Old 03-24-2011, 03:43 PM
cncb cncb is offline
Sage Icon
 
Join Date: Jul 2006
Posts: 1,271
Quote:
Originally Posted by cncb View Post
I noticed that the new channel logos in the beta are not currently showing up with the API.
Will the http api be able to access these new logos? Thanks.
__________________
-Craig
Reply With Quote
  #339  
Old 03-24-2011, 04:53 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by cncb View Post
Will the http api be able to access these new logos? Thanks.
I think it should be able to access the new logos. I'm simply calling the api and converting it to a regular image. I'm not sure if sagetv is allowing it to be accessed or not. ie, if the channel logs are hosted on a remote site, then the GetLogo api may not return a usuable image that can be "remoted" (at least not easily).

Have you tested the it to see if works or not?
Reply With Quote
  #340  
Old 03-24-2011, 06:38 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
Is this the right URL?

Code:
http://<server>:<port>/sagex/api?c=GetChannelLogo&1=channel:11150&2=Large&3=1&4=true
Here's the result I get:

Code:
<Result><![CDATA[]]></Result>
__________________
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.

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
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


All times are GMT -6. The time now is 06:13 PM.


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