mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Merge branch 'master' of github.com:henry-oberholtzer/beets into discogs-anv-support
This commit is contained in:
commit
267428f0a4
13 changed files with 74 additions and 24 deletions
|
|
@ -72,4 +72,4 @@ d93ddf8dd43e4f9ed072a03829e287c78d2570a2
|
||||||
# Moved plugin docs Further Reading chapter
|
# Moved plugin docs Further Reading chapter
|
||||||
33f1a5d0bef8ca08be79ee7a0d02a018d502680d
|
33f1a5d0bef8ca08be79ee7a0d02a018d502680d
|
||||||
# Moved art.py utility module from beets into beetsplug
|
# Moved art.py utility module from beets into beetsplug
|
||||||
28aee0fde463f1e18dfdba1994e2bdb80833722f
|
28aee0fde463f1e18dfdba1994e2bdb80833722f
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -94,3 +94,6 @@ ENV/
|
||||||
|
|
||||||
# pyright
|
# pyright
|
||||||
pyrightconfig.json
|
pyrightconfig.json
|
||||||
|
|
||||||
|
# Versioning
|
||||||
|
beets/_version.py
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,26 @@ from sys import stderr
|
||||||
|
|
||||||
import confuse
|
import confuse
|
||||||
|
|
||||||
__version__ = "2.4.0"
|
# Version management using poetry-dynamic-versioning
|
||||||
|
from ._version import __version__, __version_tuple__
|
||||||
|
from .util import deprecate_imports
|
||||||
|
|
||||||
__author__ = "Adrian Sampson <adrian@radbox.org>"
|
__author__ = "Adrian Sampson <adrian@radbox.org>"
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str):
|
||||||
|
"""Handle deprecated imports."""
|
||||||
|
return deprecate_imports(
|
||||||
|
old_module=__name__,
|
||||||
|
new_module_by_name={
|
||||||
|
"art": "beetsplug._utils",
|
||||||
|
"vfs": "beetsplug._utils",
|
||||||
|
},
|
||||||
|
name=name,
|
||||||
|
version="3.0.0",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncludeLazyConfig(confuse.LazyConfig):
|
class IncludeLazyConfig(confuse.LazyConfig):
|
||||||
"""A version of Confuse's LazyConfig that also merges in data from
|
"""A version of Confuse's LazyConfig that also merges in data from
|
||||||
YAML files specified in an `include` setting.
|
YAML files specified in an `include` setting.
|
||||||
|
|
@ -39,3 +55,6 @@ class IncludeLazyConfig(confuse.LazyConfig):
|
||||||
|
|
||||||
|
|
||||||
config = IncludeLazyConfig("beets", __name__)
|
config = IncludeLazyConfig("beets", __name__)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["__version__", "__version_tuple__", "config"]
|
||||||
|
|
|
||||||
7
beets/_version.py
Normal file
7
beets/_version.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is auto-generated during the build process.
|
||||||
|
# Do not edit this file directly.
|
||||||
|
# Placeholders are replaced during substitution.
|
||||||
|
# Run `git update-index --assume-unchanged beets/_version.py`
|
||||||
|
# to ignore local changes to this file.
|
||||||
|
__version__ = "0.0.0"
|
||||||
|
__version_tuple__ = (0, 0, 0)
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
from . import art, vfs
|
||||||
|
|
||||||
|
__all__ = ["art", "vfs"]
|
||||||
|
|
@ -16,17 +16,25 @@
|
||||||
libraries.
|
libraries.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Any, NamedTuple
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, NamedTuple
|
||||||
|
|
||||||
from beets import util
|
from beets import util
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from beets.library import Library
|
||||||
|
|
||||||
|
|
||||||
class Node(NamedTuple):
|
class Node(NamedTuple):
|
||||||
files: dict[str, Any]
|
files: dict[str, int]
|
||||||
dirs: dict[str, Any]
|
# Maps filenames to Item ids.
|
||||||
|
|
||||||
|
dirs: dict[str, Node]
|
||||||
|
# Maps directory names to child nodes.
|
||||||
|
|
||||||
|
|
||||||
def _insert(node, path, itemid):
|
def _insert(node: Node, path: list[str], itemid: int):
|
||||||
"""Insert an item into a virtual filesystem node."""
|
"""Insert an item into a virtual filesystem node."""
|
||||||
if len(path) == 1:
|
if len(path) == 1:
|
||||||
# Last component. Insert file.
|
# Last component. Insert file.
|
||||||
|
|
@ -40,7 +48,7 @@ def _insert(node, path, itemid):
|
||||||
_insert(node.dirs[dirname], rest, itemid)
|
_insert(node.dirs[dirname], rest, itemid)
|
||||||
|
|
||||||
|
|
||||||
def libtree(lib):
|
def libtree(lib: Library) -> Node:
|
||||||
"""Generates a filesystem-like directory tree for the files
|
"""Generates a filesystem-like directory tree for the files
|
||||||
contained in `lib`. Filesystem nodes are (files, dirs) named
|
contained in `lib`. Filesystem nodes are (files, dirs) named
|
||||||
tuples in which both components are dictionaries. The first
|
tuples in which both components are dictionaries. The first
|
||||||
|
|
@ -17,10 +17,11 @@
|
||||||
import cProfile
|
import cProfile
|
||||||
import timeit
|
import timeit
|
||||||
|
|
||||||
from beets import importer, library, plugins, ui, vfs
|
from beets import importer, library, plugins, ui
|
||||||
from beets.autotag import match
|
from beets.autotag import match
|
||||||
from beets.plugins import BeetsPlugin
|
from beets.plugins import BeetsPlugin
|
||||||
from beets.util.functemplate import Template
|
from beets.util.functemplate import Template
|
||||||
|
from beetsplug._utils import vfs
|
||||||
|
|
||||||
|
|
||||||
def aunique_benchmark(lib, prof):
|
def aunique_benchmark(lib, prof):
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,11 @@ from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import beets
|
import beets
|
||||||
import beets.ui
|
import beets.ui
|
||||||
from beets import dbcore, logging, vfs
|
from beets import dbcore, logging
|
||||||
from beets.library import Item
|
from beets.library import Item
|
||||||
from beets.plugins import BeetsPlugin
|
from beets.plugins import BeetsPlugin
|
||||||
from beets.util import as_string, bluelet
|
from beets.util import as_string, bluelet
|
||||||
|
from beetsplug._utils import vfs
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from beets.dbcore.query import Query
|
from beets.dbcore.query import Query
|
||||||
|
|
|
||||||
|
|
@ -694,12 +694,10 @@ class SpotifyPlugin(
|
||||||
audio_features = self.track_audio_features(spotify_track_id)
|
audio_features = self.track_audio_features(spotify_track_id)
|
||||||
if audio_features is None:
|
if audio_features is None:
|
||||||
self._log.info("No audio features found for: {}", item)
|
self._log.info("No audio features found for: {}", item)
|
||||||
continue
|
else:
|
||||||
for feature in audio_features.keys():
|
for feature, value in audio_features.items():
|
||||||
if feature in self.spotify_audio_features.keys():
|
if feature in self.spotify_audio_features:
|
||||||
item[self.spotify_audio_features[feature]] = audio_features[
|
item[self.spotify_audio_features[feature]] = value
|
||||||
feature
|
|
||||||
]
|
|
||||||
item["spotify_updated"] = time.time()
|
item["spotify_updated"] = time.time()
|
||||||
item.store()
|
item.store()
|
||||||
if write:
|
if write:
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ New features:
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
- :doc:`plugins/spotify` Ensure ``spotifysync`` keeps popularity, ISRC, and
|
||||||
|
related fields current even when audio features requests fail. :bug:`6061`
|
||||||
- :doc:`plugins/spotify` Fixed an issue where track matching and lookups could
|
- :doc:`plugins/spotify` Fixed an issue where track matching and lookups could
|
||||||
return incorrect or misleading results when using the Spotify plugin. The
|
return incorrect or misleading results when using the Spotify plugin. The
|
||||||
problem occurred primarily when no album was provided or when the album field
|
problem occurred primarily when no album was provided or when the album field
|
||||||
|
|
@ -53,8 +55,13 @@ Other changes:
|
||||||
- Moved ``art.py`` utility module from ``beets`` into ``beetsplug`` namespace as
|
- Moved ``art.py`` utility module from ``beets`` into ``beetsplug`` namespace as
|
||||||
it is not used in the core beets codebase. It can now be found in
|
it is not used in the core beets codebase. It can now be found in
|
||||||
``beetsplug._utils``.
|
``beetsplug._utils``.
|
||||||
|
- Moved ``vfs.py`` utility module from ``beets`` into ``beetsplug`` namespace as
|
||||||
|
it is not used in the core beets codebase. It can now be found in
|
||||||
|
``beetsplug._utils``.
|
||||||
- :class:`beets.metadata_plugin.MetadataSourcePlugin`: Remove discogs specific
|
- :class:`beets.metadata_plugin.MetadataSourcePlugin`: Remove discogs specific
|
||||||
disambiguation stripping.
|
disambiguation stripping.
|
||||||
|
- When installing ``beets`` via git or locally the version string now reflects
|
||||||
|
the current git branch and commit hash. :bug:`4448`
|
||||||
|
|
||||||
For developers and plugin authors:
|
For developers and plugin authors:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,6 @@ FILENAME_AND_UPDATE_TEXT: list[tuple[Path, UpdateVersionCallable]] = [
|
||||||
PYPROJECT,
|
PYPROJECT,
|
||||||
lambda text, new: re.sub(r"(?<=\nversion = )[^\n]+", f'"{new}"', text),
|
lambda text, new: re.sub(r"(?<=\nversion = )[^\n]+", f'"{new}"', text),
|
||||||
),
|
),
|
||||||
(
|
|
||||||
BASE / "beets" / "__init__.py",
|
|
||||||
lambda text, new: re.sub(
|
|
||||||
r"(?<=__version__ = )[^\n]+", f'"{new}"', text
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(CHANGELOG, update_changelog),
|
(CHANGELOG, update_changelog),
|
||||||
(BASE / "docs" / "conf.py", update_docs_config),
|
(BASE / "docs" / "conf.py", update_docs_config),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -156,9 +156,18 @@ web = ["flask", "flask-cors"]
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
beet = "beets.ui:main"
|
beet = "beets.ui:main"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.poetry-dynamic-versioning]
|
||||||
|
enable = true
|
||||||
|
vcs = "git"
|
||||||
|
format = "{base}.dev{distance}+{commit}"
|
||||||
|
|
||||||
|
[tool.poetry-dynamic-versioning.files."beets/_version.py"]
|
||||||
|
persistent-substitution = true
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry_dynamic_versioning.backend"
|
||||||
|
|
||||||
[tool.pipx-install]
|
[tool.pipx-install]
|
||||||
poethepoet = ">=0.26"
|
poethepoet = ">=0.26"
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
"""Tests for the virtual filesystem builder.."""
|
"""Tests for the virtual filesystem builder.."""
|
||||||
|
|
||||||
from beets import vfs
|
|
||||||
from beets.test import _common
|
from beets.test import _common
|
||||||
from beets.test.helper import BeetsTestCase
|
from beets.test.helper import BeetsTestCase
|
||||||
|
from beetsplug._utils import vfs
|
||||||
|
|
||||||
|
|
||||||
class VFSTest(BeetsTestCase):
|
class VFSTest(BeetsTestCase):
|
||||||
Loading…
Reference in a new issue