SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Software

Notices

SageTV Software Discussion related to the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the SageTV software application should be posted here. (Check the descriptions of the other forums; all hardware related questions go in the Hardware Support forum, etc. And, post in the customizations forum instead if any customizations are active.)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-03-2018, 02:06 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Setting padding via API?

I have default padding set within Sage (v9), but when I schedule a recording using the webui, the default padding is always zero and needs to be set manually. That's a bit of an irritation, but I believe that is expected behaviour. If I'm wrong and is there a way of doing automatic padding via the webui, someone please correct me!

However, may main question is - Is there a way of setting the padding for a manual recording and/or a favourite using the Sage API? I'm asking because I control most of my Sage viewing via the Kodi plugin. If there is an API call to set the padding for a scheduled recording, I (think I) could conceivably create a context menu item to at least set the padding with one click.

Any advice/suggestions gratefully received.

syrel
Reply With Quote
  #2  
Old 03-03-2018, 02:33 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 6,568
I don't think that there is an API call to just add padding - I think this is dealt with my changing the StopTime parameter in a call to SetRecordingTimes in the Airing API. So to add 30 minutes of airings you would increment StopTime by 1800 (or 1800000 if it is in ms).

see: http://download.sage.tv/api/sage/api...g, long, long)

Quote:
SetRecordingTimes
public java.lang.Object SetRecordingTimes(sage.Airing Airing, long StartTime, long StopTime)
Modifies or creates a time-based recording that is associated with this Airing. This is also a type of Manual Record.
Parameters:
Airing - the Airing object
StartTime - the time the recording of this Airing should start
StopTime - the time the recording of this Airing should stop
Returns:
true if the call succeeds, otherwise a localized error message is returned
__________________
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
  #3  
Old 03-03-2018, 02:41 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Thanks. Hmm, that seems tricky. I'm wondering how I would avoid setting an absolute time in case the epg schedule changes at a later date. Could I potentially send a command that says 'make the start time XX milliseconds before the airing start time?'.

syrel
Reply With Quote
  #4  
Old 03-04-2018, 05:07 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
The Favorite API has a SetStartPadding and SetStopPadding, is that what you are looking for?

http://download.sage.tv/api/sage/api...(sage.Favorite, long)
Reply With Quote
  #5  
Old 03-04-2018, 05:11 AM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Ideally, I'd like it more for manual recordings.

thanks

syrel
Reply With Quote
  #6  
Old 03-04-2018, 07:52 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
I guess I'm a little confused based on the requirements.

You mention Favorites and Manual Recording (or time based recording).

So, if it's a favorite, then you use the FavouriteAPI to adjust the padding. If it's a Manaul Recording (ie, you've said, record this show on this channel at this time) then it's a time based recording the Wayner's response is how you adjust that.

I'm not sure what you are asking here if neither of those things are what you need or want

I guess there isn't an api like AdjustPadding(Airing, +/-mins) that will look at the airing and if it's a part of a favorite then it will adjust the favorite, but if if a manual recording it will adjust the scheduled start/end times. Although you could easily add that using the sagex services and javascript and/or you could cleverly create it as well using the EvaluateExpression api and passing a bunch of nested sagetv apis using sagetv's If api.
Reply With Quote
  #7  
Old 03-04-2018, 10:39 AM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Thanks for replying. I might not be explaining clearly - or it might just be that I'm confused (and confusing)...

Favourites - okay, can see how SetStartPadding works, thanks.

Manual record - What I want to be able to do is, having set up a timed record, to send a command that says 'set start [airingtimestart - 5 mins] and set end [airingtimeend + 5 minutes]'. My interpretation of SetRecordingTimes is that it requires me to input a specific/absolute time (i.e. 10.25pm) and not a 'relative to airingtime' number, which could prove a problem if the airingtime changes at all. Or am I misinterpreting SetRecordingTimes?

thanks

syrel
Reply With Quote
  #8  
Old 03-04-2018, 02:46 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
Quote:
Originally Posted by syrel View Post
Thanks for replying. I might not be explaining clearly - or it might just be that I'm confused (and confusing)...

Favourites - okay, can see how SetStartPadding works, thanks.

Manual record - What I want to be able to do is, having set up a timed record, to send a command that says 'set start [airingtimestart - 5 mins] and set end [airingtimeend + 5 minutes]'. My interpretation of SetRecordingTimes is that it requires me to input a specific/absolute time (i.e. 10.25pm) and not a 'relative to airingtime' number, which could prove a problem if the airingtime changes at all. Or am I misinterpreting SetRecordingTimes?

thanks

syrel
I guess for a manual recording (and I don't use them, so I could be misunderstanding how they work) you are saying , record Hawaii Five 0, on channel 800, from 9pm to 10pm. Now if for some reason the guide changes and hawaii five 0 got moved to 10pm-11pm, I don't think the manual recording would update, and record it at 10pm. I think you'd get the show that aired at 9pm... since the manual recording is really just recording a channel with a given start/end. For that reason, I think that setting the Airing Start/End is really all you can do, and hope that the guide doesn't change it's time.

So to update an existing airing you'd end up with something like,

Code:
SetRecordingsTimes(airing, GetAiringStartTime(ariing)-3*60*1000, GetAringEndTime(airing)+3*60*1000)
Which would add a 3 minute padding to both ends of its current start/end times.

Now granted, I know very little about Manual Recordings, so I could be completely wrong here
Reply With Quote
  #9  
Old 03-04-2018, 03:30 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
If I remember rightly, if the epg schedule for a manually recorded individual program changes, sage sends an alert telling me that it has re-scheduled the timed record and asks me if that's ok. I guess the question is whether the preset padding also changes - but given that I always set the padding via the webserver and I can't remember a case where this has caused me a problem, I'm guessing it probably does. Anyway, you've given me enough hints that I might be able to make this work. Thanks.
Reply With Quote
  #10  
Old 03-04-2018, 05:33 PM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,035
Stuckless, I think what youíre referring to is a timed recording. I think a manual recording is just a way of marking an EPG entry for recording, without making it a favorite. Itís still linked to an airing.

Iím not sure what the timed recording in the GUI does but is suspect it just adds a dummy entry to the schedule without linking to a specific airing.
Reply With Quote
  #11  
Old 03-05-2018, 06:39 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,186
Quote:
Originally Posted by syrel View Post
If I remember rightly, if the epg schedule for a manually recorded individual program changes, sage sends an alert telling me that it has re-scheduled the timed record and asks me if that's ok.
I use manual recordings very infrequently, but... I thought the alert you got was that the EPG data for the manual recording changed.

I don't think Sage reschedules manual recordings, I'm not sure how it could. When the EPG gets updated, all the sudden that old airing is gone, how is it to know which new airing corresponds to it?
Reply With Quote
  #12  
Old 03-05-2018, 10:06 AM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,035
Quote:
Originally Posted by stanger89 View Post
I use manual recordings very infrequently, but... I thought the alert you got was that the EPG data for the manual recording changed.

I don't think Sage reschedules manual recordings, I'm not sure how it could. When the EPG gets updated, all the sudden that old airing is gone, how is it to know which new airing corresponds to it?
It can still follow the airing by the ID. Itís no different than tracking watched versus unwatched favorites. Think of a manual record as a one episode favorite.
Reply With Quote
  #13  
Old 03-07-2018, 03:16 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
OK, I've been giving this a go but hit a wall. My command is
/sagex/api?command=SetRecordingsTimes&1=(airing:14903964, GetAiringStartTime(airing:14903964)-2*60*1000, GetAiringEndTime(airing:14903964)+5*60*1000)

But I get an 'unknow sage command' error. Full log below. Any ideas?

thanks

syrel

<error sagex-version="7.1.9.1"><message>Unknown Sage Command: SetRecordingsTimes</message><exception>java.lang.RuntimeException: Unknown Sage Command: SetRecordingsTimes
at sagex.remote.factory.request.SageRPCRequestFactory.createRequest(SageRPCRequestFactory.java:1211)
at sagex.remote.api.ApiHandler.callSageAPI(ApiHandler.java:208)
at sagex.remote.api.ApiHandler.handleRequest(ApiHandler.java:150)
at sagex.remote.SagexServlet.doPost(SagexServlet.java:87)
at sagex.remote.SagexServlet.doGet(SagexServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
</exception></error>
Reply With Quote
  #14  
Old 03-08-2018, 07:19 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
THere is a few things wrong there...

Apis are called as... c=APINAME&1=arg1&2=arg2... (see /sagex/api for examples of using the API)

args CANNOT be expressions. So to do what you want to todo, you need to use the EvaluateExpression command passing a single arg with your complete expressions...

/sagex/api?c=EvaluateExpression&1=SetRecordingsTimes(GetAiringForID(14903964), GetAiringStartTime(GetAriingForID(14903964))-2*60*1000, GetAiringEndTime(GetAiringForID(14903964))+5*60*1000)

So when calling an API like SetWatched, for example, you can pass 1=mediafile:12312 or 1=airing:123123, etc but you can't pass an expression as the arg. The only API that supports expressions is the EvaluateExpression AND in there you cannot use the "airing:" notation, so you need resolve the airing by ID.
Reply With Quote
  #15  
Old 03-08-2018, 02:24 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Ah, I see. I have much to learn; thanks for the guidance.
syrel
Reply With Quote
  #16  
Old 03-13-2018, 04:12 PM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
I'm beginning to wonder if what I want to do isn't actually possible using SetRecordingTimes:

Just to prove I can get something to work (ie I'm not being completely stupid), I've tried
/sagex/api?c=EvaluateExpression&1=GetAiringForID(14903964)
/sagex/api?c=EvaluateExpression&1=GetScheduleEndTime(GetAiringForID(14903964))
/sagex/api?c=EvaluateExpression&1=GetScheduleEndTime(GetAiringForID(14903964))-300000

(I've also swapped GetAiringEndTime in place of GetScheduleEndTime and had same results)

And all produce the correct response. But when I try
/sagex/api?c=EvaluateExpression&1=SetRecordingTimes(GetAiringForID(14903964), GetAiringStartTime(GetAiringForID(14903964))-300000, GetAiringEndTime(GetAiringForID(14903964))+300000

I just get an empty result and nothing changes.

syrel
Reply With Quote
  #17  
Old 03-13-2018, 05:18 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
It looks like you are missing a bracket at the end

/sagex/api?c=EvaluateExpression&1=SetRecordingTimes(GetAiringForID(14903964), GetAiringStartTime(GetAiringForID(14903964))-300000, GetAiringEndTime(GetAiringForID(14903964))+300000)
Reply With Quote
  #18  
Old 03-14-2018, 01:45 AM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
Thanks again. Yes I had missed off the bracket, but it didn't solve the problem. I've simplified it as much as I can just to get it working:

/sagex/api?c=EvaluateExpression&1=SetRecordingTimes(GetAiringForID(14903964), 1521153300000, 1521157800000)

but still nothing. Browser just returns "<Result/>" and no change to the schedule times.

syrel
Reply With Quote
  #19  
Old 03-14-2018, 06:31 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,539
Quote:
Originally Posted by syrel View Post
Thanks again. Yes I had missed off the bracket, but it didn't solve the problem. I've simplified it as much as I can just to get it working:

/sagex/api?c=EvaluateExpression&1=SetRecordingTimes(GetAiringForID(14903964), 1521153300000, 1521157800000)

but still nothing. Browser just returns "<Result/>" and no change to the schedule times.

syrel
Since you are simplifying... try this...

/sagex/api?c=SetRecordingTimes&1=airing:14903964&2=1521153300000&3=1521157800000

That calls the SetRecordingTimes api directly passing the airing, and the start/end times. Now, the reply for this should either be "true" or an error message.
Reply With Quote
  #20  
Old 03-14-2018, 08:30 AM
syrel syrel is offline
Sage Advanced User
 
Join Date: Oct 2010
Location: UK
Posts: 86
That produces the following error:

<error>
<message>Cannot Serialize Reply</message>
<class>sage.Catbert$AsyncTaskID</class>
<data>sage.Catbert$AsyncTaskID@1e916d8</data>
<exception>
Cannot Serialize [Field: Result, Type: sage.Catbert$AsyncTaskID ToString: sage.Catbert$AsyncTaskID@1e916d8]</exception>
</error>

syrel
Reply With Quote
Reply


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

Advanced Search
Display Modes

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
SageTV Not seeing my padding setting kiddo3110 SageTV Software 1 08-07-2007 12:42 PM
padding....yes another question about padding...sorry kricker SageTV Software 8 09-25-2005 10:51 PM
Padding ... :( snoopy SageTV Customizations 2 07-20-2005 01:00 AM
Padding bgorrell SageTV Beta Test Software 1 05-03-2004 07:37 AM
Padding in 2.x.... JasonJoel SageTV Beta Test Software 10 04-16-2004 05:36 PM


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


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