SageTV Community  

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

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-04-2011, 05:19 PM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Programmatically add timed recordings to SageTV?

Hi,

I'm looking for ways to programmatically add recordings to my SageTV server.

I've got a custom built application which I use to control my AV gear. From within this application I've also got an EPG view and I'd like to be able communicate to SageTV right from there to create timed recordings at the specified date and the specified channel. The Mobile Web UI provides this functionality for me, since you can easily POST data via HTTP to create timed recordings, but I'm having some issues getting the Mobile Web UI and the XmlTV plugin (which I use alot) to play nice and work simultaneously, like I've described in this thread:

http://forums.sagetv.com/forums/showthread.php?t=57387

So my question is, is there some other way I can programmatically create a timed recording? I believe the sageTCPServer plugin provides this functionality since the TiSageTV iOS app can create recordings through it. I'm having a hard time finding any documentation describing it though.

I could write my own plugin in java with which I could communicate somehow and the plugin would call the appropriate methods in Sage to create those recordings. I'm also having a hard time finding any API documentation for SageTV.

Any ideas for me? What would be the best way?
Reply With Quote
  #2  
Old 11-04-2011, 05:32 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
SageTV API is documented here.
Reply With Quote
  #3  
Old 11-04-2011, 06:54 PM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Quote:
Originally Posted by BobPhoenix View Post
SageTV API is documented here.
Thanks!
Reply With Quote
  #4  
Old 11-04-2011, 07:53 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by hagur View Post
I believe the sageTCPServer plugin provides this functionality since the TiSageTV iOS app can create recordings through it.
Have you tried the SageTCPServer wiki?

RAS

Record a show.

Type|ShowID

Type = type of recording (Manual, FirstRun, ReRun, Any)
ShowID = ID of the show.
__________________
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
  #5  
Old 11-05-2011, 06:19 AM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
No, actually I had not seen that page

RAS expects a show ID, if I'm just creating a timed recording at a specified date with a specified duration, how does that work? Also, if Type = Manual, where exactly do I specify the date/time and duration?

I've also been reading the API documentation and AiringAPI.SetRecordingTimes seems to do what I want, but it takes in an Airing object. Do I need to create an Airing object first, using the AddAiring method, and then pass that object into SetRecordingTimes?

If that's the case, what should I set as the ShowExternalID of the Airing object, since the documentation states that the "Show should already have been added".

I'm a little confused ....
Reply With Quote
  #6  
Old 11-05-2011, 06:45 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Typically, the assumption is that SageTV has already built a database, so the ShowID or AiringID can basically be seen as some index in a table. The ShowExternalID is the ID from the original guide data, something like EP1234567890.

In your case, you probably want to use CreateTimedRecording:

http://download.sage.tv/api/sage/api...lang.String%29
__________________
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
  #7  
Old 11-05-2011, 08:02 AM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Thanks, this seems to be exactly what I was looking for :-)

I appreciate your help.
Reply With Quote
  #8  
Old 11-05-2011, 03:30 PM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Hehe wow, I seem to suck more at Java than I thought

I'm just trying to write a simple test class that calls some functions in SageTV, this is what I have got:

import Sage.*;

public class CreateRecording
{
public static void main (String[] args)
{
//sage.api.Channel channel = sage.api.ChannelAPI.GetChannelForStationID(1);
System.out.println("Done");
}
}

Then I try to compile it using:
javac CreateRecording.java

I get this error:

CreateRecording.java:1: error: package Sage does not exist
import Sage.*;
^
1 error

I'm doing this from within the SageTV directory where Sage.jar resides.

I'm a complete newbie when it comes to Java, so please be kind
Reply With Quote
  #9  
Old 11-05-2011, 06:21 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
First I'd recommend using either Eclipse or Netbeans for an IDE rather than calling the Java compiler directly. There is a small learning curve, but probably less of a learning curve than using the compiler.

Next I'd recommend using the sagex api's by stuckless which provide a nice set of wrappers that make the Sage api's a lot more usable. (They also provide a way to execute the Sage api's remotely but that's another story.) Alternatively you can use GKusnick's api's which provide a strongly typed set of wrappers.

If you decide to use sagex the code would look like this:

Code:
import sagex.api.*;

public class CreateRecording {

    public static void main (String[] args) {
        Object channel = ChannelAPI.GetChannelForStationID(1);
    }
}
Edit: Your import probably isn't working because you capitalized "Sage.*", use "import sage.*;" instead.
__________________

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
  #10  
Old 11-07-2011, 03:33 PM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Hi, just downloaded the Sagex API, this is the file I downloaded:

http://code.google.com/p/customsaget...2.zip&can=2&q=

It only containted this file here: sagex-api.jar which I copied to the sagetv/sagetv directory.

This is the exact code I'm trying to compile:

Code:
import sagex.api.*;

public class CreateRecording
{
	public static void main (String[] args)
	{
		Object channel = ChannelAPI.GetChannelForStationID(1);
		System.out.println("Done!");
	}
}
This is what I get:

C:\Program Files (x86)\SageTV\SageTV>javac CreateRecording.java
CreateRecording.java:1: error: package sagex.api does not exist
import sagex.api.*;
^
CreateRecording.java:7: error: cannot find symbol
Object channel = ChannelAPI.GetChannelForStationID(1);
^
symbol: variable ChannelAPI
location: class CreateRecording
2 errors

Still have not tried an IDE ... might try Eclipse soon.

Any ideas?
Reply With Quote
  #11  
Old 11-07-2011, 04:10 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
The import statement requires that the library (.jar) is somehow included in the project, not sure how you would do that from the command line, as using an IDE is simpler...
__________________
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
  #12  
Old 11-07-2011, 04:46 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Fonceur View Post
The import statement requires that the library (.jar) is somehow included in the project, not sure how you would do that from the command line, as using an IDE is simpler...
Totally agree. Using an IDE (Eclipse or Netbeans) is the way to go. Once you do that there are settings where you tell the IDE where to find the necessary .jar files. I have no clue how to compile using the command line.
__________________

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
  #13  
Old 11-07-2011, 06:18 PM
hagur hagur is offline
Sage User
 
Join Date: Feb 2007
Posts: 65
Oh that explains it then. My assumption was that the compiler would just pick it up since it was in the class path and I was referring to it with the using statement.
Reply With Quote
  #14  
Old 11-07-2011, 07:11 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
By default, javac only includes that listed in the CLASSPATH environment variable in the classpath. Add -cp argument to javac to get it to compile that file.
__________________
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
timed recordings BKeadle SageMC Custom Interface 1 06-01-2010 05:23 PM
Timed Recordings very limited freedml SageTV Software 3 05-08-2009 06:43 AM
Timed Recordings bug in SageTV ssalah SageTV Software 2 03-01-2008 02:05 PM
Timed recordings rmans SageTV Recorder Software 3 09-14-2004 11:25 PM
timed recordings msm SageTV Software 2 08-21-2003 08:06 AM


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


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