Remove spectrograms from Python 2 also [#5594].

For 0.10.0 we're removing specrograms entirely for reliability. This change only
disables spectrograms and updates install docs and Dockerfiles. We still need
to strip out all the spectrogram code and extlib/freesound/.
This commit is contained in:
Ben Sturmfels 2020-04-28 14:39:53 +10:00
parent 4a150fa29e
commit 4f3f70d15a
No known key found for this signature in database
GPG Key ID: 023C05E2C9C068F0
4 changed files with 14 additions and 35 deletions

View File

@ -33,10 +33,7 @@ gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \ gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \ gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \ gstreamer1.0-plugins-ugly \
libsndfile1-dev \ python-gst-1.0
python-gst-1.0 \
python-numpy \
python-scipy
RUN apt-get install -y \ RUN apt-get install -y \
gir1.2-gst-plugins-base-1.0 \ gir1.2-gst-plugins-base-1.0 \
@ -61,8 +58,6 @@ RUN ./bootstrap.sh
RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure --without-python3 RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure --without-python3
RUN make RUN make
RUN ./bin/pip install scikits.audiolab
RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini
RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini

View File

@ -81,10 +81,7 @@ gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \ gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \ gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \ gstreamer1.0-plugins-ugly \
libsndfile1-dev \ python3-gst-1.0
python3-gst-1.0 \
python3-numpy \
python3-scipy
# Install video dependencies. # Install video dependencies.
RUN apt-get install -y \ RUN apt-get install -y \
@ -142,9 +139,6 @@ RUN ./bootstrap.sh
RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure
RUN make RUN make
# Only supported on Python 2.
# RUN ./bin/pip install scikits.audiolab
# Only safe if being run on a clean git checkout. Otherwise you may have already # Only safe if being run on a clean git checkout. Otherwise you may have already
# customised mediagoblin.ini to already install these. # customised mediagoblin.ini to already install these.
RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini

View File

@ -119,27 +119,16 @@ Audio
===== =====
To enable audio, install the GStreamer and python-gstreamer bindings (as well To enable audio, install the GStreamer and python-gstreamer bindings (as well
as whatever GStreamer plugins you want, good/bad/ugly), SciPy and NumPy are as whatever GStreamer plugins you want, good/bad/ugly).
also needed for the audio spectrograms.
To install these on Debianoid systems, run:: To install these on Debianoid systems, run::
sudo apt-get install python3-gst-1.0 gstreamer1.0-plugins-{base,bad,good,ugly} \ sudo apt-get install python3-gst-1.0 gstreamer1.0-plugins-{base,bad,good,ugly} \
gstreamer1.0-libav python3-numpy python3-scipy libsndfile1-dev libasound2-dev gstreamer1.0-libav
.. note:: .. note::
scikits.audiolab will display a warning every time it's imported if you do MediaGoblin previously generated spectrograms for uploaded audio. This
not compile it with alsa support. Alsa support is not necessary for the GNU feature has been removed due to incompatibility with Python 3. We may
MediaGoblin application. consider re-adding this feature in the future.
If you're running Python 2, install ``scikits.audiolab`` for the spectrograms::
.. code-block:: bash
./bin/pip install numpy==1.9.1
./bin/pip install scikits.audiolab==0.10.2
For Python 3 ``scikits.audiolab`` has no package yet. Instead of the cool
specrogram image a static icon is used until we found a replacement. (#5467)
Add ``[[mediagoblin.media_types.audio]]`` under the ``[plugins]`` section in your Add ``[[mediagoblin.media_types.audio]]`` under the ``[plugins]`` section in your
``mediagoblin.ini`` and restart MediaGoblin. ``mediagoblin.ini`` and restart MediaGoblin.

View File

@ -43,15 +43,14 @@ gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst from gi.repository import GObject, Gst
Gst.init(None) Gst.init(None)
import numpy
import six
# TODO: Now unused - remove.
class Python2AudioThumbnailer(object): class Python2AudioThumbnailer(object):
def __init__(self): def __init__(self):
_log.info('Initializing {0}'.format(self.__class__.__name__)) _log.info('Initializing {0}'.format(self.__class__.__name__))
def spectrogram(self, src, dst, **kw): def spectrogram(self, src, dst, **kw):
import numpy
# This third-party bundled module is Python 2-only. # This third-party bundled module is Python 2-only.
from mediagoblin.media_types.audio import audioprocessing from mediagoblin.media_types.audio import audioprocessing
@ -113,8 +112,8 @@ class Python2AudioThumbnailer(object):
th.save(dst) th.save(dst)
class Python3AudioThumbnailer(Python2AudioThumbnailer): class DummyAudioThumbnailer(Python2AudioThumbnailer):
"""Dummy thumbnailer for Python 3. """A thumbnailer that just outputs a stock image.
The Python package used for audio spectrograms, "scikits.audiolab", does not The Python package used for audio spectrograms, "scikits.audiolab", does not
support Python 3 and is a constant source of problems for people installing support Python 3 and is a constant source of problems for people installing
@ -133,7 +132,9 @@ class Python3AudioThumbnailer(Python2AudioThumbnailer):
img.save(dst) img.save(dst)
AudioThumbnailer = Python3AudioThumbnailer if six.PY3 else Python2AudioThumbnailer # Due to recurring problems with spectrograms under Python 2, and the fact we're
# soon dropping Python 2 support, we're disabling spectrogram thumbnails. See #5594.
AudioThumbnailer = DummyAudioThumbnailer
class AudioTranscoder(object): class AudioTranscoder(object):