Skip to content

fix(fetchart): sources definition#6508

Merged
snejus merged 1 commit intobeetbox:masterfrom
ShimmerGlass:fetchart-sources
Apr 7, 2026
Merged

fix(fetchart): sources definition#6508
snejus merged 1 commit intobeetbox:masterfrom
ShimmerGlass:fetchart-sources

Conversation

@ShimmerGlass
Copy link
Copy Markdown
Contributor

Description

The fetchart plugin would silently drop unknown sources defined in config, leading to hard to debug problems.
The plugin now errors when an unknown source is configured, or when no sources are configured.
In addition, a single string is now a valid value for sources to either enable all sources with an *, or a single source.

Fixes: #6336

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@ShimmerGlass ShimmerGlass requested a review from a team as a code owner April 6, 2026 08:23
@github-actions github-actions bot added the fetchart fetchart plugin label Apr 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

@ShimmerGlass ShimmerGlass force-pushed the fetchart-sources branch 2 times, most recently from 96c34ad to bc7f8a2 Compare April 6, 2026 08:28
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.19%. Comparing base (137c049) to head (142e946).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beetsplug/fetchart.py 71.42% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6508   +/-   ##
=======================================
  Coverage   70.18%   70.19%           
=======================================
  Files         147      147           
  Lines       18680    18698   +18     
  Branches     3042     3046    +4     
=======================================
+ Hits        13111    13125   +14     
- Misses       4927     4930    +3     
- Partials      642      643    +1     
Files with missing lines Coverage Δ
beets/util/config.py 100.00% <100.00%> (ø)
beetsplug/fetchart.py 74.24% <71.42%> (-0.17%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just a pair of nit-like comments

@ShimmerGlass
Copy link
Copy Markdown
Contributor Author

@snejus all updated, added a changelog entry!

The fetchart plugin would silently drop unknown sources defined in
config, leading to hard to debug problems.
The plugin now errors when an unknown source is configured, or when no
sources are configured.
In addition, a single string is now a valid value for `sources` to
either enable all sources with an `*` or a single source.

Fixes: beetbox#6336
Copy link
Copy Markdown
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@snejus snejus enabled auto-merge April 7, 2026 16:57
@snejus snejus merged commit 7b0e4e2 into beetbox:master Apr 7, 2026
14 checks passed
@snejus
Copy link
Copy Markdown
Member

snejus commented Apr 7, 2026

@ShimmerGlass Oh no, this just broke beetcamp which dynamically registers its art source:

    def loaded(self) -> None:
        """Add our own artsource to the fetchart plugin."""
        for plugin in plugins.find_plugins():
            if isinstance(plugin, fetchart.FetchArtPlugin):
                if isinstance(fetchart.ART_SOURCES, set):
                    fetchart.ART_SOURCES.add(BandcampAlbumArt)
                else:
                    fetchart.ART_SOURCES[self.data_source] = BandcampAlbumArt
                    fetchart.SOURCE_NAMES[BandcampAlbumArt] = self.data_source
                    fetchart.SOURCES_ALL.append(self.data_source)
                bandcamp_fetchart = BandcampAlbumArt(self._log, self.config)
                plugin.sources = [bandcamp_fetchart, *plugin.sources]
                break

Furthermore, I wonder why does it report bandcamp=* instead of simply bandcamp?

UserError: setting bandcamp=* is not recognized

My configuration:

fetchart:
  lastfm_key: XXX
  auto: yes
  store_source: yes
  sources:
    - filesystem
    - cover_art_url
    - bandcamp
    - lastfm
    - "*"
  maxwidth: 700

@snejus
Copy link
Copy Markdown
Member

snejus commented Apr 7, 2026

Ignore me: the issue is gone if I remove bandcamp from my configuration which is indeed not found since BandcampAlbumArt uses capitalised Bandcamp:

class BandcampAlbumArt(BandcampRequestsHandler, fetchart.RemoteArtSource):
    NAME = ID = "Bandcamp"

@ShimmerGlass ShimmerGlass deleted the fetchart-sources branch April 8, 2026 06:48
@ShimmerGlass
Copy link
Copy Markdown
Contributor Author

no problem :)

@snejus
Copy link
Copy Markdown
Member

snejus commented Apr 8, 2026

@ShimmerGlass Though this question still stands:

Furthermore, I wonder why does it report bandcamp=* instead of simply bandcamp?

UserError: setting bandcamp=* is not recognized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetchart fetchart plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fetchart: "no art found" when filesystem is only source

2 participants