[mythtv] Services API: Does Dvr/AddRecordSchedule work?
Bill Meek
keemllib at gmail.com
Sat Oct 13 01:28:09 UTC 2018
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_recording_rule.py
Type: text/x-python
Size: 10479 bytes
Desc: not available
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20181012/18ab4779/attachment.py>
More information about the mythtv-dev
mailing list