|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Calling SetRecordingTimes()
Writing a plugin that will automatically modify recording times for live events (i.e. sports) so that games that run long will automatically record until they're over.
All was going well until it was time to call the SetRecordingTimes() API call. According to the API docs, this call returns true on success or an error message on failure, so here's a code fragment of how I'm calling it: Code:
if(mon.isOver()) // End the recording now { try { apiResult = sage.SageTV.api("SetRecordingTimes", new Object[] {airing, getScheduleStartTime(), now.getTime()}); if((Boolean)apiResult == true) { retVal = RecordingExtenderResult.STOPPED; scheduleEndTime = now.getTime(); } } catch(ClassCastException e) // Call must have returned a string (error) { if(apiResult != null) SageRecordingExtender.logger.logln(apiResult.toString()); retVal = RecordingExtenderResult.FAILED_STOPPED; } } Help appreciated. |
#2
|
||||
|
||||
If you got an error message back from the API call, what does that message say? If you didn't get a message back, what did you get? What's your evidence for assuming that it dropped into the catch block (since it doesn't look like you're printing out the exception)?
What I generally do in such cases is to do a bunch of experimentation with Expression Evaluator to make sure I understand how the API works and what it returns in various cases. If it really returns a Boolean in some cases and a String in others (as the API docs seem to imply), then I'd be inclined to use instanceof instead of a cast exception to discriminate. But I suppose that's a matter of taste. As a side note, if you're going to be doing a lot of SageTV API calls from Java, you may find the API wrappers in my Tools package handy.
__________________
-- Greg |
#3
|
||||
|
||||
A quick test in Expression Evaluator seems to indicate that SetRecordingTimes() returns neither a Boolean nor a String, but a sage.e$e (whatever that is). This is the same result type returned by Watch(), and I have to admit I've always been somewhat baffled about what it is and how to use it. The error-handling code surrounding calls to Watch() in the standard STV obviously works, but minor variations on that code do not seem to work as I would have expected.
Maybe Andy or somebody else in the know will chime in with more specific info.
__________________
-- Greg |
#4
|
|||
|
|||
It's dropping into the catch block because the method that the above chunk is from is returning my FAILED_STOPPED enum value plus it's writing to the logfile I created [SageRecordingExtender.log.logln()], but it's not writing anything useful.
Code:
========== Mon Mar 26 15:24:08 EDT 2007 Currently recording 'Seinfeld' until Mon Mar 26 15:30:00 EDT 2007 Monitor: sage.e$e@17777a1 ERROR: Attempt to stop recording failed! I'm not able to play with anything in Studio as I'm still using the trial version while I experiment to see if Sage will be able to do what I want. |
#5
|
|||
|
|||
Quote:
Now I just need to know what a sage.e$e is and how to interpret it. |
#6
|
||||
|
||||
Apparently it's "a localized error message"
I don't see anywhere obvious where the default STV does anything with that "localized error message". |
#7
|
||||
|
||||
Right, in the three existing calls to SetRecordingTimes() it just drops the result on the floor. However there are numerous calls to Watch() where it checks the result and displays it in a popup dialog if != true. What I don't quite understand is how it does that comparison, or converts the result to a string for display, since neither .equals() nor .toString() seems to do anything useful. This may be another case where there's special magic built into the widget interpreter to make these objects play nice with Studio code, but unfortunately not with Java code.
__________________
-- Greg |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SageMC 6.31 and calling an external application | CanadianEh | SageMC Custom Interface | 6 | 01-23-2007 06:09 PM |
D11 linkup hardware and cabling options - calling all D11 owners | IncredibleHat | Hardware Support | 7 | 01-14-2007 02:45 AM |
Recording drive question (calling all hard drive experts!) | Kirby | Hardware Support | 4 | 07-17-2006 12:01 PM |
Calling all MT users, Demedius plus Channel Order! | rsagetv99 | SageTV EPG Service | 16 | 04-12-2006 10:58 AM |
Calling Girder experts! | soulprops77 | General Discussion | 3 | 12-09-2005 05:10 PM |