File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1412,6 +1412,13 @@ def __init__(self) -> None:
14121412 if s_cls .available (self ._log , self .config )
14131413 for c in s_cls .VALID_MATCHING_CRITERIA
14141414 ]
1415+ # When 'sources' is given as a plain string (e.g. "sources: filesystem"
1416+ # instead of "sources: [filesystem]"), confuse's Pairs template
1417+ # iterates over individual characters instead of treating it as a
1418+ # single-item list. Normalize to a list first via as_str_seq().
1419+ raw_sources = self .config ["sources" ].get ()
1420+ if isinstance (raw_sources , str ):
1421+ self .config ["sources" ].set (raw_sources .split ())
14151422 sources = sanitize_pairs (
14161423 self .config ["sources" ].as_pairs (default_value = "*" ),
14171424 available_sources ,
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ Bug fixes
2222- :ref: `replace `: Made ``drive_sep_replace `` regex logic more precise to prevent
2323 edge-case mismatches (e.g., a song titled "1:00 AM" would incorrectly be
2424 considered a Windows drive path).
25+ - :doc: `plugins/fetchart `: Fix ``sources `` config given as a plain string
26+ (e.g. ``sources: filesystem ``) being parsed character-by-character instead of
27+ as a single source name. :bug: `6336 `
2528- :doc: `plugins/fish `: Fix AttributeError. :bug: `6340 `
2629- :ref: `import-cmd ` Autotagging by explicit release or recording IDs now keeps
2730 candidates from all enabled metadata sources instead of dropping matches when
Original file line number Diff line number Diff line change @@ -1047,3 +1047,28 @@ def test_px(self):
10471047 def test_percent (self ):
10481048 self ._load_with_config ("0% 0.00% 5.1% 5% 100%" .split (), False )
10491049 self ._load_with_config ("00% 1.234% foo5% 100.1%" .split (), True )
1050+
1051+
1052+ class SourcesConfigTest (unittest .TestCase ):
1053+ """Test that the 'sources' config option handles both list and plain
1054+ string values correctly.
1055+ """
1056+
1057+ def test_sources_as_list (self ):
1058+ config ["fetchart" ]["sources" ] = ["filesystem" ]
1059+ plugin = fetchart .FetchArtPlugin ()
1060+ assert len (plugin .sources ) == 1
1061+ assert isinstance (plugin .sources [0 ], fetchart .FileSystem )
1062+
1063+ def test_sources_as_string (self ):
1064+ config ["fetchart" ]["sources" ] = "filesystem"
1065+ plugin = fetchart .FetchArtPlugin ()
1066+ assert len (plugin .sources ) == 1
1067+ assert isinstance (plugin .sources [0 ], fetchart .FileSystem )
1068+
1069+ def test_sources_as_space_separated_string (self ):
1070+ config ["fetchart" ]["sources" ] = "filesystem coverart"
1071+ plugin = fetchart .FetchArtPlugin ()
1072+ ids = [type (s ).ID for s in plugin .sources ]
1073+ assert "filesystem" in ids
1074+ assert "coverart" in ids
You can’t perform that action at this time.
0 commit comments