SageTV Community  

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

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-13-2014, 10:58 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
API questions

From within Java or Groovy what call can I use to find the SageTV install path (usually something like "C:\Program Files\SageTV") and also the root Fanart folder? I am guessing the latter is from the Phoenix API? Or did that become part of the core system with V7?

Are there docs posted for the Phoenix API? I tried looking but couldn't find anything other than Sagex stuff.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #2  
Old 01-13-2014, 01:20 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
From within Java or Groovy what call can I use to find the SageTV install path (usually something like "C:\Program Files\SageTV") and also the root Fanart folder? I am guessing the latter is from the Phoenix API? Or did that become part of the core system with V7?

Are there docs posted for the Phoenix API? I tried looking but couldn't find anything other than Sagex stuff.
Phoenix Javadoc
https://code.google.com/p/sagephoeni...q=#makechanges

SageTV JavaDoc
http://download.sage.tv/api/index.ht...e-summary.html

As a URL can you get the central fanart folder by calling...
http://192.168.1.10:8080/sagex/phoen...tCentralFolder

As as url you can probably get your local sagetv server directory using...
http://192.168.1.10:8080/sagex/api?c...uteFilePath&1=
Reply With Quote
  #3  
Old 01-13-2014, 01:49 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
So from within Java/Groovy can I just use:

FanartFolder=phoenix.fanart.GetFanartCentralFolder() ?

And then the Sage folder would be:

SageFolder=Utility.GetAbsoluteFilePath()

I was looking for it in the Global and Configuration trees rather than in Utility.

Thanks - I am using these for the creation of Fanart for Home Videos, but hopefully you can add that functionality to BMT.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #4  
Old 01-13-2014, 02:39 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
So from within Java/Groovy can I just use:

FanartFolder=phoenix.fanart.GetFanartCentralFolder() ?

And then the Sage folder would be:

SageFolder=Utility.GetAbsoluteFilePath()

I was looking for it in the Global and Configuration trees rather than in Utility.

Thanks - I am using these for the creation of Fanart for Home Videos, but hopefully you can add that functionality to BMT.
I've never used groovy, but I think the answer is yes for both of those API uses. (The latter assumes you are using sagex api... otherwise you have to use the SageAPI.call() way of calling the API)
Reply With Quote
  #5  
Old 01-13-2014, 10:32 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
The GetAbsoluteFilePath works with Sagex from a URL but when I try to call it from Java it seems to want an argument of type file. Here is the doc for that call:

Code:
GetAbsoluteFilePath

public java.lang.String GetAbsoluteFilePath(java.io.File FilePath)
Returns the full path name from the specified file path..
Parameters:
FilePath - the filepath to get the full path from
Returns:
the full path from the specified file path
Since:
7.0
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #6  
Old 01-13-2014, 10:44 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
You seem to have been anticipating Google's purchase of Nest as it looks like you have already integrated Nest functionality into Sage!
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #7  
Old 01-13-2014, 10:59 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
If you want to get the Sage install dir, I'd just access it via (in Groovy syntax):

Code:
def sageHome = System.getProperty('user.dir')
println sageHome
On most Windows systems, this should print C:\Program Files (x86)\SageTV\SageTV\

(Less the x86 on 32bit systems.)

SageTV.exe always launches its JVM instance from the dir containing the exe so the user.dir sys property is always going to be set to the root directory of the Sage install.
__________________
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
  #8  
Old 01-13-2014, 11:04 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Thanks Slugger - I guess the downside is that when I run this in the Groovy Console I get the path of the Groovy folder.

Any ideas on the issue that I mention above for the Fanart folder? Can I hook into the phoenix api from Groovy? I have tried to do so from the Groovy Console, installing the phoenix jar in the lib folder and restarting the console. What would the syntax be for a call to phoenix - do I have it right above in post 3?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #9  
Old 01-13-2014, 11:19 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Make me put my thinking cap on tonight... To always get your server's root install dir, farm the getProp() call to the Sage server via sagex using the WidgetAPI (again, in Groovy):

Code:
def sageHome = WidgetAPI.EvaluateExpression('java_lang_System_getProperty("user.dir")')
println sageHome
Regardless of where you call that from (remote, local, GroovyConsole, Eclipse, whereever...), that snippet should always print the Sage root install dir.

As for phoenix, after copying the jar, did you import it into your script? The SageGroovy console only auto imports the sagex APIs. Additional external APIs will have to be explicitly imported. The syntax looks a little off (to me) just because it looks like you're missing the class. The link to the javadocs is a zip, which I wasn't dloading and installing locally at this hour, sorry. But anyway, it'll work, it's just a matter of installing the jar, importing the proper class(es) and then properly calling the methods you want.

Happy scripting!
__________________
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
  #10  
Old 01-13-2014, 11:22 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
I think I forgot to import it into my script. That will do it.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #11  
Old 01-14-2014, 04:51 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
You seem to have been anticipating Google's purchase of Nest as it looks like you have already integrated Nest functionality into Sage!
Yeah I bought a NEST some time ago, and then I added API support for it into phoenix in case someone wanted to play around with it. It's limited at the moment.

Quote:
Originally Posted by wayner View Post
The GetAbsoluteFilePath works with Sagex from a URL but when I try to call it from Java it seems to want an argument of type file. Here is the doc for that call:

Code:
GetAbsoluteFilePath

public java.lang.String GetAbsoluteFilePath(java.io.File FilePath)
Returns the full path name from the specified file path..
Parameters:
FilePath - the filepath to get the full path from
Returns:
the full path from the specified file path
Since:
7.0

Code:
GetAbsoluteFilePaht("")
or
Code:
GetAbsoluteFilePaht(new java.io.File(""))
Reply With Quote
  #12  
Old 01-14-2014, 10:44 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
OK, I am still having trouble using Phoenix calls in Groovy. Here is my code:
Code:
import sagex.phoenix.*
println (fanart.LocalFanartSupport.GetFanartCentralFolder())
And here is the error message:
Code:
groovy.lang.MissingMethodException: No signature of method: static sagex.phoenix.fanart.LocalFanartSupport.GetFanartCentralFolder() is applicable for argument types: () values: []
Possible solutions: GetFanartCentralFolder(), SetFanartCentralFolder(java.lang.String)
What am I f'n up?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #13  
Old 01-14-2014, 11:22 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Quote:
Originally Posted by stuckless View Post
Code:
GetAbsoluteFilePaht("")
or
Code:
GetAbsoluteFilePaht(new java.io.File(""))
Method 1 didn't work - you need to pass a file as an argument. But method two did - thanks for the help!
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server

Last edited by wayner; 01-14-2014 at 11:25 PM.
Reply With Quote
  #14  
Old 01-15-2014, 08:51 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by wayner View Post
OK, I am still having trouble using Phoenix calls in Groovy. Here is my code:
Code:
import sagex.phoenix.*
println (fanart.LocalFanartSupport.GetFanartCentralFolder())
And here is the error message:
Code:
groovy.lang.MissingMethodException: No signature of method: static sagex.phoenix.fanart.LocalFanartSupport.GetFanartCentralFolder() is applicable for argument types: () values: []
Possible solutions: GetFanartCentralFolder(), SetFanartCentralFolder(java.lang.String)
What am I f'n up?
Ok, the ONLY package you need to be concerned with in the java docs, is the "phoenix" package, since that is the Phoenix API (everything else is just supporting code).

under the phoenix package, there are packages for each sub package (ie, fanart, metadata, menus, media, etc).

to call it, you probably don't need any imports... and just use...

Code:
String folder = phoenix.fanart.GetFanartCentralFolder();
for each phoenix api, it's 'phoenix' dot 'apigroup' dot 'ApiName'... pretty much exactly like it's laid out in the "phoenix" package in the javadoc.
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
ROKU Questions, Plex Questions ThePaladinTech The SageTV Community 16 08-26-2013 10:53 PM
Newbie questions... hardware questions bigRoN18 Hardware Support 9 10-13-2010 02:50 PM
DVB-S & DVB-T Questions Mahoney Hardware Support 8 08-08-2005 10:35 AM
Some questions Athfar SageTV Software 2 08-05-2005 01:29 PM
Two Questions RageFury SageTV Software 3 10-30-2004 01:09 PM


All times are GMT -6. The time now is 07:03 PM.


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