[mythtv] Services API for ChannelServices / Video Source

Klaas de Waal klaas.de.waal at gmail.com
Thu Oct 31 21:42:04 UTC 2019


On Thu, 31 Oct 2019 at 15:07, Bill Meek <keemllib at gmail.com> wrote:
>
> 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
> _______________________________________________

Hi Bill,

I have committed support for the bouquet ID and the region ID in the
services API  but not yet tested anything. I followed what was done
for the dvb_nit_id and I think the C++ code is correct and complete. I
made some changes to the Javascript code but I am not sure what else
needs to be done there or what needs to be done in other non-C++ parts
of the code. I do appreciate it very much if you would have a look at
it.

For the people who read this and feel tempted to play with this, the
code does need the fields bouquet_id and region_id and one way to test
it is to add these fields manually to database table videosource; SQL
commands given in dbcheck.cpp. Changing the schema version to 1351 in
mythversion.h does this and also activates the mythtv-setup gui for
these fields but this should only be done on a discardable database.


Groetjes,
Klaas.


More information about the mythtv-dev mailing list