From: Ben Sturmfels Date: Tue, 28 Apr 2020 04:39:53 +0000 (+1000) Subject: Remove spectrograms from Python 2 also [#5594]. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4f3f70d15a4ab58819c788ce6732d51428a8de19;p=mediagoblin.git 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/. --- diff --git a/Dockerfile-debian-python2-sqlite b/Dockerfile-debian-python2-sqlite index 6c53e9a8..b055a434 100644 --- a/Dockerfile-debian-python2-sqlite +++ b/Dockerfile-debian-python2-sqlite @@ -33,10 +33,7 @@ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-base \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-ugly \ -libsndfile1-dev \ -python-gst-1.0 \ -python-numpy \ -python-scipy +python-gst-1.0 RUN apt-get install -y \ gir1.2-gst-plugins-base-1.0 \ @@ -61,8 +58,6 @@ RUN ./bootstrap.sh RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure --without-python3 RUN make -RUN ./bin/pip install scikits.audiolab - RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini diff --git a/Dockerfile-debian-python3-sqlite b/Dockerfile-debian-python3-sqlite index edbe4c81..ea0639f8 100644 --- a/Dockerfile-debian-python3-sqlite +++ b/Dockerfile-debian-python3-sqlite @@ -81,10 +81,7 @@ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-base \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-ugly \ -libsndfile1-dev \ -python3-gst-1.0 \ -python3-numpy \ -python3-scipy +python3-gst-1.0 # Install video dependencies. RUN apt-get install -y \ @@ -142,9 +139,6 @@ RUN ./bootstrap.sh RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure 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 # customised mediagoblin.ini to already install these. RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini diff --git a/docs/source/siteadmin/media-types.rst b/docs/source/siteadmin/media-types.rst index 2e21c340..10656cd6 100644 --- a/docs/source/siteadmin/media-types.rst +++ b/docs/source/siteadmin/media-types.rst @@ -119,27 +119,16 @@ Audio ===== 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 -also needed for the audio spectrograms. +as whatever GStreamer plugins you want, good/bad/ugly). To install these on Debianoid systems, run:: 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:: - scikits.audiolab will display a warning every time it's imported if you do - not compile it with alsa support. Alsa support is not necessary for the GNU - MediaGoblin application. - -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) + MediaGoblin previously generated spectrograms for uploaded audio. This + feature has been removed due to incompatibility with Python 3. We may + consider re-adding this feature in the future. Add ``[[mediagoblin.media_types.audio]]`` under the ``[plugins]`` section in your ``mediagoblin.ini`` and restart MediaGoblin. diff --git a/mediagoblin/media_types/audio/transcoders.py b/mediagoblin/media_types/audio/transcoders.py index 445ede51..a67f4429 100644 --- a/mediagoblin/media_types/audio/transcoders.py +++ b/mediagoblin/media_types/audio/transcoders.py @@ -43,15 +43,14 @@ gi.require_version('Gst', '1.0') from gi.repository import GObject, Gst Gst.init(None) -import numpy -import six - +# TODO: Now unused - remove. class Python2AudioThumbnailer(object): def __init__(self): _log.info('Initializing {0}'.format(self.__class__.__name__)) def spectrogram(self, src, dst, **kw): + import numpy # This third-party bundled module is Python 2-only. from mediagoblin.media_types.audio import audioprocessing @@ -113,8 +112,8 @@ class Python2AudioThumbnailer(object): th.save(dst) -class Python3AudioThumbnailer(Python2AudioThumbnailer): - """Dummy thumbnailer for Python 3. +class DummyAudioThumbnailer(Python2AudioThumbnailer): + """A thumbnailer that just outputs a stock image. The Python package used for audio spectrograms, "scikits.audiolab", does not support Python 3 and is a constant source of problems for people installing @@ -133,7 +132,9 @@ class Python3AudioThumbnailer(Python2AudioThumbnailer): 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):