Opened 5 years ago
Closed 5 years ago
Last modified 5 years ago
#13546 closed Patch - Bug Fix (fixed)
Hardcoded call to 'python' from mythtv-programs for lyrics
Reported by: | rcrdnalor | Owned by: | Bill Meek |
---|---|---|---|
Priority: | minor | Milestone: | 31.0 |
Component: | Plugin - MythMusic | Version: | Master Head |
Severity: | medium | Keywords: | python3 |
Cc: | Ticket locked: | no |
Description
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.
Attachments (1)
Change History (5)
Changed 5 years ago by
Attachment: | hardcoded_call_to_python_master.patch added |
---|
comment:1 Changed 5 years ago by
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?.
comment:2 Changed 5 years ago by
Owner: | changed from paulh to Bill Meek |
---|---|
Status: | new → accepted |
comment:3 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:4 Changed 5 years ago by
Milestone: | needs_triage → 31.0 |
---|
Patch to use configured python version