[mythtv] Services API for ChannelServices / Video Source
Bill Meek
keemllib at gmail.com
Thu Oct 31 14:07:11 UTC 2019
On 10/31/19 6:26 AM, Klaas de Waal wrote:
> Hi,
>
> I've recently added two parameters to the Video Source page of
> mythtv-setup, bouquet_id and region_id. These are used to get the
> channel numbers for Freesat and BSkyB on the Astra-2 28.2E satellite.
>
> I am now about to add these parameters to functions in
> channelservices.cpp/h such as AddVideoSource which are, as I
> understand it, part of what is called the Services API. This does
> compile cleanly but I am not aware of which other code or applications
> does actually use this.
>
> Are there applications I can test with or other steps I should take or
> shall I just commit this to master and wait what happens?
>
> Groetjes,
> Klaas.
Hi Klaas,
If you'd like me to run some test, just let me know when you push.
Otherwise, if it helps, I just added a parameter to an existing endpoint here:
git log --author Bill --patch -1
5 files changed:
libs/libmythservicecontracts/services/channelServices.h
libs/libmythtv/channelutil.{cpp,h}
programs/mythbackend/services/channel.{cpp,h}
For testing, curl works OK. Sounds like the above adds/changes data,
which means a POST is required. Here's an old example of the format:
curl \
--data ChanID=1021 \
...
--data XMLTVID=20454 \
backendNameOrIP:6544/Channel/UpdateDBChannel
Or, you can use the Python bindings for the Services API similar to this:
#!/usr/bin/python
"""Simple POST example"""
from __future__ import print_function
import os.path
import sys
from MythTV.services_api import send as api
def main():
"""Check arguments and call send() with a POST"""
try:
behost = sys.argv[1]
dbhost = sys.argv[2]
dbuser = sys.argv[3]
dbpswd = sys.argv[4]
except IndexError:
sys.exit('\nUsage: {} backend_host db_host db_user db_password'
.format(os.path.basename(sys.argv[0])))
postdata = {'HostName': dbhost, 'UserName': dbuser, 'Password': dbpswd}
backend = api.Send(host=behost)
backend.send(endpoint='Myth/TestDBSettings', postdata=postdata,
opts={'wrmi': True})
if __name__ == '__main__':
main()
--
Bill
More information about the mythtv-dev
mailing list