[mythtv] Services API: Does Dvr/AddRecordSchedule work?
Bill Meek
keemllib at gmail.com
Sun Oct 14 17:34:07 UTC 2018
On 10/13/2018 12:17 PM, John P Poet wrote:
> Good to know. I had not thought of retrieving a template first. That
> seems like a good approach.
>
> Has anyone written a set of python tools for controlling Myth with the
> services API, that has been published somewhere? The documentation is
> currently somewhat sparse, and examples might be helpful.
Hey John,
This was my attempt at a cookbook. It builds up from simple examples to a
full program with arguments. Since I don't speak fluent Python, I wanted
to show how to use the returned values from the API (and I'd guess that
you were using some of it.)
https://www.mythtv.org/wiki/Python_API_Examples
I've been looking at putting the Python Services API *next to* the existing
Python bindings. That's where mine is installed. I'm not clear on how to
incorporate it into the build process.
Unless we're living in parallel universes, you're using
https://github.com/billmeek/MythTVServicesAPI
and that was my idea of a tool. My original plan was to create a library of
things that could be imported. Like: Capture.py/Content.py/Guide.py...Video.py.
Plus one Connection.py that the others used.
But they were essentially the same, all returning a dictionary with the returned
parameters. And so the more generic backend.send(...) is what I decided on.
I do have a tool just for testing (cleverly named 'api') and it's --help looks
like this:
$ api --help
usage: api [-h] [--debug] [--digest <user:pass>] [--host <host> [<host> ...]]
--endpoint <ep> [--noetag] [--nogzip] [--oneline] [--port <port>]
[--postdata <pd> [<pd> ...] | --rest <rest> [<rest> ...]] [--quiet]
[--timeout <seconds>] [--usexml] [--version] [--wrmi]
Services API Tester
optional arguments:
-h, --help show this help message and exit
--debug output additional information (False)
--digest <user:pass> digest username:password
--noetag tell the backend not to return a ETag (False)
--nogzip tell the backend not to return gzipped data (False)
--oneline print the response on one line, no formatting (False)
--port <port> back/frontend port (6544)
--postdata <pd> [<pd> ...]
Tag=Value *
--rest <rest> [<rest> ...]
Tag=Value *
--quiet don't print any responses (False)
--timeout <seconds> seconds to wait for a response (10)
--usexml ask for an XML response (False)
--version show program's version number and exit
--wrmi allows postdata to be sent to the server (False)
required arguments:
--host <host> [<host> ...]
server hostname(s) or IP address(s)
--endpoint <ep> endpoint to test
* E.g. Id=1 TitleRegEx=\*News\*. Default values are in ()s.
--
Bill
More information about the mythtv-dev
mailing list