Mailing List Archive

python binding
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

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: python binding [ In reply to ]
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.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: python binding [ In reply to ]
On 5/23/20 4:00 AM, Stephen Worthington wrote:
> 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.

^^^ Right.

A little more specifically, at configure time, the default in v31 is python3.
The bindings were rewritten to run under Python v2 or v3. Using the --python
configure switch allows selecting the Python *executable* of choice.

At compile time, programs that have a shebang of "#!/usr/bin/env python" will have
their shebangs changed to the version of Python used at configure time. It
could end up as "#!/usr/bin/python3", for example.

Of course that doesn't apply to any local/Wiki/... scripts and they must be
updated to run under Python v3, if that is the version of choice. As time
goes on, (hopefully) contributors will update Wiki pages for Python v3.

Some distributions may not have all of the Python packages required for
a version of Python. If missing, The bindings won't be installed. The
output of ./configure will show missing packages.

https://code.mythtv.org/cgit/mythtv/tree/mythtv/configure#n6987

--
Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org