[mythtv] Services API: Does Dvr/AddRecordSchedule work?
John P Poet
jppoet at gmail.com
Sat Oct 13 01:45:59 UTC 2018
On Fri, Oct 12, 2018 at 7:28 PM Bill Meek <keemllib at gmail.com> wrote:
> On 10/12/2018 07:49 PM, 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?
> >
> > 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.
> >
> > 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.
>
> It does work. My usual 1st choice is: mythbackend --setverbose
> http:debug,upnp:debug
> (probably overkill.) And check the backend log...
>
> Here's a snippet from one of my tests:
>
> endpoint = 'Dvr/AddRecordSchedule'
>
> params_not_sent = ('AverageDelay', 'CallSign', 'Id', 'LastDeleted',
> 'LastRecorded', 'NextRecording', 'ParentId')
>
> for param in params_not_sent:
> try:
> del template[param]
> except KeyError:
> pass
> ...
>
>
> I also use:
>
> logging.basicConfig(level=logging.DEBUG if args['debug'] else
> logging.INFO)
>
> logging.getLogger('requests.packages.urllib3').setLevel(logging.WARNING)
> logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
>
> and a --debug switch to the Python program to activate the log messages.
> The
> send.py you're using has a bit more on the above.
>
> I attached my add_recording_rule.py FYI. The command line (just to test,
> without --wrmi):
> add_recording_rule.py --ho ofc0 --title Elementary --debug --digest
> admin:mythtv
>
> --
> Bill
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
Thanks Bill, that should help.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20181012/49ce897b/attachment.html>
More information about the mythtv-dev
mailing list