Mailing List Archive

Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
------------------------------------+--------------------------
Reporter: rcrdnalor | Owner: paulh
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Keywords: python3
Ticket locked: 0 |
------------------------------------+--------------------------
MythTV is on the way to switch to python3. But some programs
use to call 'python <script-name> <options>' for grabbing lyrics
for the MythTV-Music plugin (note the hardcoded 'python' call).

Note: Pythons PEP 394 states that
"The python command should always invoke Python 2".

But python2 is not available on modern linux installations, because
python2 is deprecated and EOF starting with January 1st, 2020.

Latest releases of various linux distributions do not install python by
default,
only python3 (like Ubuntu 19.10).

Use the following command to identify those hardcoded calls to python:
{{{
$ grep -nHIrF --include=*.cpp -- QString\(\"python
mythtv/programs/mythutil/musicmetautils.cpp:494:
p.start(QString("python %1 -v").arg(scripts.at(x)));
mythtv/programs/mythutil/musicmetautils.cpp:538:
p.start(QString("python %1 --artist=\"%2\" --album=\"%3\" --title=\"%4\"
--filename=\"%5\"")
mythtv/programs/mythbackend/mainserver.cpp:6951:
p.start(QString("python %1 -v").arg(scripts.at(x)));
}}}

Once these lyric scripts are able to speak python3 as well (see #13545),
we can use the configured python version (i.e.: either python2 or
python3).

The attached patch uses the configured python version to call
these lyric grabber scripts.

Note: This patch is compile time tested only.

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics [ In reply to ]
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
--------------------------------+------------------------------
Reporter: rcrdnalor | Owner: paulh
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Resolution:
Keywords: python3 | Ticket locked: 0
--------------------------------+------------------------------
Changes (by rcrdnalor):

* Attachment "hardcoded_call_to_python_master.patch" added.

Patch to use configured python version

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics [ In reply to ]
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
--------------------------------+------------------------------
Reporter: rcrdnalor | Owner: paulh
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Resolution:
Keywords: python3 | Ticket locked: 0
--------------------------------+------------------------------

Comment (by rcrdnalor):

Tested on Ubuntu 19.10 on current master.
There is only python3 installed, no python or python2 is available.



I have this album already in the database ( imported by mythutil
--scanmusic )
{{{
Artist: Angélique Kidjo
Album: Black Ivory Soul
Title: Ces Petits Riens

$ mythutil --findlyrics --songid 22

results to

/home/mythtv/.mythtv/MythMusic/22.txt

with content

<lyrics>
<artist>Angélique Kidjo</artist>
<album>Black Ivory Soul</album>
<title>Ces Petits Riens</title>
<grabber>LyricsWiki</grabber>
<lyric>Mieux vaut ne penser à rien, que de ne pas penser du tout</lyric>
<lyric>Rien c'est déjà, rien c'est déjà beaucoup</lyric>
.....
}}}

Also tested via Gui
{{{
Media Library
Listen to Music
Add title to playlist
Play title
select M (Menu) and Lyrics
}}}


and it works also with a new title, which has no lyrics in the database:
{{{
Title: Iemanja
Artist: Angélique Kidjo
Album: Black Ivory Soul
}}}
The lyrics lines are displayed on the screen during playback.


Note: The affected code belongs to MythTV, but is used by the MythMusic
plugin only.
Therefore, the configured python version is the one configured for MythTV,
not for
MythPlugins.

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546#comment:1>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics [ In reply to ]
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
--------------------------------+------------------------------
Reporter: rcrdnalor | Owner: Bill Meek
Type: Patch - Bug Fix | Status: accepted
Priority: minor | Milestone: needs_triage
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Resolution:
Keywords: python3 | Ticket locked: 0
--------------------------------+------------------------------
Changes (by Bill Meek):

* owner: paulh => Bill Meek
* status: new => accepted


--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546#comment:2>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics [ In reply to ]
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
--------------------------------+------------------------------
Reporter: rcrdnalor | Owner: Bill Meek
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone: needs_triage
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Resolution: fixed
Keywords: python3 | Ticket locked: 0
--------------------------------+------------------------------
Changes (by Roland Ernst <rcrernst@…>):

* status: accepted => closed
* resolution: => fixed


Comment:

In [changeset:"186e24a0189978bc534eaf141121db73cf375852/mythtv"
186e24a018/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="186e24a0189978bc534eaf141121db73cf375852"
Python Bindings: use configurable "python" choices

Replaces hardcoded "python" with PYTHON_EXE developed in ./configure

Requires distclean.

Closes: #13546

Signed-off-by: Bill Meek <billmeek@mythtv.org>
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546#comment:3>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13546: Hardcoded call to 'python' from mythtv-programs for lyrics [ In reply to ]
#13546: Hardcoded call to 'python' from mythtv-programs for lyrics
--------------------------------+-----------------------------
Reporter: rcrdnalor | Owner: Bill Meek
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone: 31.0
Component: Plugin - MythMusic | Version: Master Head
Severity: medium | Resolution: fixed
Keywords: python3 | Ticket locked: 0
--------------------------------+-----------------------------
Changes (by Stuart Auchterlonie):

* milestone: needs_triage => 31.0


--
Ticket URL: <https://code.mythtv.org/trac/ticket/13546#comment:4>
MythTV <http://www.mythtv.org>
MythTV Media Center