autobpm: Fix the issue with tempo being a numpy array

This commit is contained in:
Šarūnas Nejus 2024-08-15 17:09:33 +01:00
parent 03cf567a90
commit 49cae5ca23
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
4 changed files with 9 additions and 6 deletions

View file

@ -11,9 +11,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
"""Uses Librosa to calculate the `bpm` field. """Uses Librosa to calculate the `bpm` field."""
"""
from librosa import beat, load from librosa import beat, load
from soundfile import LibsndfileError from soundfile import LibsndfileError
@ -78,7 +76,7 @@ class AutoBPMPlugin(BeetsPlugin):
) )
continue continue
tempo, _ = beat.beat_track(y=y, sr=sr) (tempo, *_), _ = beat.beat_track(y=y, sr=sr)
bpm = round(tempo) bpm = round(tempo)
item["bpm"] = bpm item["bpm"] = bpm
self._log.info( self._log.info(

View file

@ -18,6 +18,10 @@ Bug fixes:
* Improved naming of temporary files by separating the random part with the file extension. * Improved naming of temporary files by separating the random part with the file extension.
* Fixed the ``auto`` value for the :ref:`reflink` config option. * Fixed the ``auto`` value for the :ref:`reflink` config option.
* Fixed lyrics plugin only getting part of the lyrics from ``Genius.com`` :bug:`4815` * Fixed lyrics plugin only getting part of the lyrics from ``Genius.com`` :bug:`4815`
* :doc:`plugins/autobpm`: Fix the ``TypeError`` where tempo was being returned
as a numpy array. Update ``librosa`` dependency constraint to prevent similar
issues in the future.
:bug:`5289`
For packagers: For packagers:
@ -26,6 +30,7 @@ For packagers:
* The `typing_extensions` is required for Python 3.10 and below. * The `typing_extensions` is required for Python 3.10 and below.
Other changes: Other changes:
* :doc:`contributing`: The project now uses `poetry` for packaging and * :doc:`contributing`: The project now uses `poetry` for packaging and
dependency management. This change affects project management and mostly dependency management. This change affects project management and mostly
affects beets developers. Please see updates in :ref:`getting-the-source` and affects beets developers. Please see updates in :ref:`getting-the-source` and

2
poetry.lock generated
View file

@ -3188,4 +3188,4 @@ web = ["flask", "flask-cors"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.8,<4" python-versions = ">=3.8,<4"
content-hash = "f0fd6d00bf9a47f06a49863ba4675d393a4b392feec38dd83c1064c98381eb31" content-hash = "863a8a4fb3e20fe6688394c02614f7c296d239e7d7ecfb4af04926a92de7610c"

View file

@ -48,7 +48,7 @@ dbus-python = { version = "*", optional = true }
flask = { version = "*", optional = true } flask = { version = "*", optional = true }
flask-cors = { version = "*", optional = true } flask-cors = { version = "*", optional = true }
langdetect = { version = "*", optional = true } langdetect = { version = "*", optional = true }
librosa = { version = ">=0.10.2.post1", optional = true } librosa = { version = "^0.10.2.post1", optional = true }
mutagen = { version = ">=1.33", optional = true } mutagen = { version = ">=1.33", optional = true }
Pillow = { version = "*", optional = true } Pillow = { version = "*", optional = true }
py7zr = { version = "*", optional = true } py7zr = { version = "*", optional = true }