[mythtv-users] using mythtv as clockradio

Hika van den Hoven hikavdh at gmail.com
Thu Jan 21 05:34:03 UTC 2016


Hoi Bill,

Thursday, January 21, 2016, 6:17:10 AM, you wrote:

> On 01/20/2016 10:32 PM, Hika van den Hoven wrote:
>> Thursday, January 21, 2016, 5:10:45 AM, you wrote:
>>> The above would be something like:
>>
>>>     import Utilities as api
>>>     postdata = { 'HostName':args.fe, 'Key':'WatchTVGuide', 'Value':0 }
>>>     api.Send(host=args.host, port=args.port, endpoint=Myth/PutSetting, postdata=postdata)

> Neglected to add: opts={'wrmi':True} after postdata above. It's a
> safety feature that makes sure that *we really mean it* (changing
> data, that is.) Also, by setting wrmi to False, a program can test
> before actually sending to the host, especially if opts['debug']
> is True.

>> Yes, I saw that stuff about sending as a POST and didn't know what
>> that meant. Thanks for the link as the main service api only links to
>> Perl examples.

> Fixed. It already appeared in the category, but not an entry matching
> the Perl one you spotted at the bottom of the page. Thanks.

>> but that would not count for calling the single value and getting an
>> empty answer, while the value is there! Or must such a specific info
>> call also be packed in a 'POST'?

> Not 100% clear I understand the issue. Any GET/POST response should be
> checked for a failure. The Python module does that and returns an Abort
> or Warning. See the following lines here: Full example using Dvr/GetUpcomingList
> at that page:

> if list(resp_dict.keys())[0] in ['Abort', 'Warning']:
>      sys.exit('\n{}\n'.format(list(resp_dict.values())[0]))

>> I did find though how to get data as json, which in Python is way
>> easier then xml.

> Good. That's what the module does, requests JSON and returns it in
> a dict, saving another step.

I'm missing the requests package at present. I was using
urllib2.Request. 

Message for Rich dev-python/requests should be in the python related
dependencies for MythTV in Gentoo as it is apparently used!

Tot mails,
  Hika                            mailto:hikavdh at gmail.com

"Zonder hoop kun je niet leven
Zonder leven is er geen hoop
Het eeuwige dilemma
Zeker als je hoop moet vernietigen om te kunnen overleven!"

De lerende Mens



More information about the mythtv-users mailing list