[mythtv] Services API: Does Dvr/AddRecordSchedule work?
David Engel
david at istwok.net
Sat Oct 13 01:55:51 UTC 2018
On Fri, Oct 12, 2018 at 06:49:44PM -0600, John P Poet wrote:
> I see AddRecordSchedule here
> https://www.mythtv.org/wiki/API_parameters_29#Dvr_service but when I try to
> use it, I am getting a 500 response. Is this not working, or am I not
> calling it correctly?
It worked at some time. It's possible it got broken somewhere along
the line.
> I am calling it from python:
>
> endpoint = 'Dvr/AddRecordSchedule'
> post = recrule.asDict()
> opt = {'wrmi':True}
>
> try:
> resp_dict = backend.send(endpoint=endpoint, postdata=post, opts=opt)
> except RuntimeError as error:
> sys.exit('\nFatal error: "{}"'.format(error))
> except RuntimeWarning as warning:
> print('Warning: {}'.format(warning))
>
> recrule is a classed derived from a named tuple with the various arguments
> in it, for example: ChanId, Title, Subtitle, etc.
How are you creating recrule? The strongly preferred way to do so is
to call Dvr/GetRecordSchedule first. That will give you a known, good
rule from which you can modify as needed.
There are 4 ways to call Dvr/GetRecordSchedule:
nRecordId > 0 : Return the existing recording rule itself. Not
necessarily tied to a specific program.
!sTemplate.isEmpty() : Return the existing, template rule itself.
nRecordedId > 0 : Return the rule for the given recording.
nChanId > 0 && dStartTime.isValid() : Return the matching rule for the
given program. Optionally, return an override rule when bMakeOverride
is set.
David
> I admit to not having a lot of python experience, but this seems pretty
> straight forward. I just want to verify that the Dvr/AddRecordSchedule is
> supposed to be working, before I waste a lot of time debugging this code.
> Various other Services API calls are working perfectly.
--
David Engel
david at istwok.net
More information about the mythtv-dev
mailing list