fix: skip metadata source search when query and filters are empty - #6873
fix: skip metadata source search when query and filters are empty#6873Sanjays2402 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
grug see PR fix metadata source search path. When query empty and filters empty, PR now skip API call so no more MusicBrainz 400 spam for junk files with no tags.
Changes:
- Add guard in
SearchApiMetadataSourcePlugin._search_apito return no candidates when query+filters both empty. - Add regression test to ensure empty search does not call provider and does not raise even when
raise_on_errortrue. - Add changelog entry for bug 🐛
6862.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| beets/metadata_plugins.py | Skip doomed API request when both query and filters are empty; return empty result set. |
| test/test_metadata_plugins.py | Add regression test covering empty query+filters behavior. |
| docs/changelog.rst | Document the bugfix in the changelog. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6873 +/- ##
=======================================
Coverage 75.74% 75.74%
=======================================
Files 164 164
Lines 21437 21440 +3
Branches 3379 3380 +1
=======================================
+ Hits 16237 16240 +3
Misses 4400 4400
Partials 800 800
🚀 New features to boost your workflow:
|
Items with no artist or title tags produce a search with an empty query and no filters. The request was still sent to the metadata source API, and MusicBrainz answers it with a 400 Bad Request, which was logged with a traceback once per affected file during an import. Return no candidates instead of issuing a request that cannot match anything.
6ec0eb0 to
4596bd2
Compare
|
Rebased onto master (was 56 commits behind) and fixed the docs job. The only red check was |

Description
Fixes #6862.
Items with no artist/title tags produce a search with an empty query and no filters. The request was still sent to the metadata source API, and MusicBrainz answers it with
400 Bad Request, logging a traceback once per affected file._search_apinow returns no candidates instead of issuing a request that cannot match anything.To Do
Documentation(bugfix, no user-facing option changed)test_search_api_skips_request_without_query_and_filtersfails without the fix, passes with it.)