[mythtv-users] python binding

Stephen Worthington stephen_agent at jsw.gen.nz
Sat May 23 09:00:17 UTC 2020


On Sat, 23 May 2020 14:25:30 +0800, you wrote:

>Hi
>
>I'm building 30 on a modern linux. Because of a big deal about python vs python3 it is non trivial to build with python bindings.
>What are they used for on a backend?
>
>All my metadata lookup is done on the *frontend*, what else?
>
>James

Wrong, metadata lookup for recordings and (and I think for videos in
storage groups) is done on the backend.  Recordings have their
metadata looked up automatically by mythbackend when the recording
completes, I believe, although you can trigger it manually from the
frontend.  However, I have metadata lookup disabled, so I have not
followed the ins and outs of making it work properly.

The Python bindings are also used for various ancillary software, such
as find_orphans.py and some external recorder software.  I have some
utilities of my own written in Python (mythimport, mythsgu), which are
Python 2 as I have not upgraded to v31 yet.

There is other associated software that also uses Python, but not the
MythTV Python bindings, such as mhegepgsnoop.py which gets MHEG-5 EPG
data from the New Zealand DVB-T free-to-air channels.  Mhegepgsnoop.py
is currently only available as Python 2 as far as I know.  My solution
to the problem of mythbackend being started before the network is
fully up uses my wait-until-pingable.py program which is Python 3.

As far as I know, building MythTV v30 with Python is simple.  It uses
Python 2, so you have to install Python 2 if your system does not have
it.  Most, if not all, current distros should still support installing
Python 2 alongside Python 3 - they just come with only Python 3
installed by default.  You may need to adjust Python programs to
specify which version they run if they expect the default version to
be Python 2 when it has changed to Python 3.  That should be as simple
as changing the #! line at the top of the file to specify the version:

#!/usr/bin/env python3
#!/usr/bin/env python2
#!/usr/bin/python2
#!/usr/bin/python3

instead of

#!/usr/bin/env python
#!/usr/bin/python

In Ubuntu, there are commands to change which version of Python is the
default, should that be needed.  I would not recommend doing that
unless there was no other way to do what you need.

MythTV v31 uses Python 3 by preference, but I think it was talked
about having it also work with Python 2 if Python 3 was not installed.
I am not sure if that happened.


More information about the mythtv-users mailing list