I have installed LDOCE5 viewer on Ubuntu 20.04 as described here. In summary:
Install some dependencies:
sudo apt-get install git make python pyqt5-dev-tools python3-pyqt5 \ python3-pyqt5.qtwebkit python3-lxml python3-whoosh qtgstreamer-plugins-qt5
Install further dependencies for
python3.8
on Ubuntu 20.04:sudo apt-get install python3-pip python3-setuptools python3-distutils
Download ldoce5viewer-pyqt5 into ~/Downloads:
cd ~/Downloads && git clone https://github.com/purboo/ldoce5viewer-pyqt5.git
Open the Makefile in the download folder and change
python
topython3
on line 2:gedit ~/Downloads/ldoce5viewer-pyqt5/Makefile
There is an obsolete library in the ldoce5viewer-pyqt5 called
cgi.escape()
which has been removed from python3.8. this library is used in three files. in order to fix the issue, we need to changecgi
tohtml
where we seefrom cgi import escape
in the following three files:gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/ldoce5/transform.py gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/qtgui/indexer.py gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/ldoce5/extract.py
There is an issue in the sound-player part of the software. According to this answer, to fix the issue we can open the following file and change
'appsrc.emit('push-buffer', Gst.Buffer.new_wrapped(self._data[:size]))'
to
'appsrc.emit('push-buffer', Gst.Buffer.new_wrapped(self._data[:size].data()))'
on line 114:
gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/qtgui/utils/soundplayer.py
Final step:
make && sudo make install
Now the software can be found in the installed applications (press Super key and search for ldoce5).
The installation is successful and the dictionary is mostly functional. The only issue is that clicking on a sentence or word's pronunciation does not play anything. The sound-related part of the software is in the following file:
gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/qtgui/utils/soundplayer.py
I tried to debug the issue and confirmed that:
Gstreamer is used in the software to play sound (there are other alternatives in the code, but they are not used in Ubuntu 20.04)
Gstreamer is installed on Ubuntu and words properly as per the official instructions.
The mp3 file of the sound exists and it can be downloaded (there is a download option in the gui as can be seen in the following screenshot):
I just don't know why the sound is not playing when clicking on the sound button (blue or red icons). Each time I click on one of them, the play
method of the GstreamerBackend(Backend)
class in soundplayer.py
is hit. There is no error and I could confirm that the last line of the method (self._player.set_state(Gst.State.PLAYING)
) is also reached. I could not go any further in my investigation of the issue. I appreciate any help to fix this.