This commit is contained in:
wavebyrd 2026-03-23 08:47:56 +00:00 committed by GitHub
commit 17808b1a0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 0 deletions

View file

@ -1413,6 +1413,13 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
if s_cls.available(self._log, self.config)
for c in s_cls.VALID_MATCHING_CRITERIA
]
# When 'sources' is given as a plain string (e.g. "sources: filesystem"
# instead of "sources: [filesystem]"), confuse's Pairs template
# iterates over individual characters instead of treating it as a
# single-item list. Normalize to a list first via as_str_seq().
raw_sources = self.config["sources"].get()
if isinstance(raw_sources, str):
self.config["sources"].set(raw_sources.split())
sources = sanitize_pairs(
self.config["sources"].as_pairs(default_value="*"),
available_sources,

View file

@ -38,6 +38,9 @@ Bug fixes
- :ref:`replace`: Made ``drive_sep_replace`` regex logic more precise to prevent
edge-case mismatches (e.g., a song titled "1:00 AM" would incorrectly be
considered a Windows drive path).
- :doc:`plugins/fetchart`: Fix ``sources`` config given as a plain string
(e.g. ``sources: filesystem``) being parsed character-by-character instead of
as a single source name. :bug:`6336`
- :doc:`plugins/fish`: Fix AttributeError. :bug:`6340`
- :ref:`import-cmd` Autotagging by explicit release or recording IDs now keeps
candidates from all enabled metadata sources instead of dropping matches when

View file

@ -1048,3 +1048,28 @@ class EnforceRatioConfigTest(unittest.TestCase):
def test_percent(self):
self._load_with_config("0% 0.00% 5.1% 5% 100%".split(), False)
self._load_with_config("00% 1.234% foo5% 100.1%".split(), True)
class SourcesConfigTest(unittest.TestCase):
"""Test that the 'sources' config option handles both list and plain
string values correctly.
"""
def test_sources_as_list(self):
config["fetchart"]["sources"] = ["filesystem"]
plugin = fetchart.FetchArtPlugin()
assert len(plugin.sources) == 1
assert isinstance(plugin.sources[0], fetchart.FileSystem)
def test_sources_as_string(self):
config["fetchart"]["sources"] = "filesystem"
plugin = fetchart.FetchArtPlugin()
assert len(plugin.sources) == 1
assert isinstance(plugin.sources[0], fetchart.FileSystem)
def test_sources_as_space_separated_string(self):
config["fetchart"]["sources"] = "filesystem coverart"
plugin = fetchart.FetchArtPlugin()
ids = [type(s).ID for s in plugin.sources]
assert "filesystem" in ids
assert "coverart" in ids