-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add configurable search limit to Spotify and Deezer plugins, and make the option name consistent #5960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds configurable search limits to music metadata plugins and standardizes the configuration option naming. The changes enable users to control how many search results are returned from Spotify and Deezer APIs, while maintaining backward compatibility for the MusicBrainz plugin's existing configuration.
- Add
search_limit
configuration option (default 5) to Spotify and Deezer plugins - Rename MusicBrainz
searchlimit
tosearch_limit
with deprecation warning for old option - Update documentation to reflect the new configuration options
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
beetsplug/spotify.py | Add search_limit config and enforce limit on API responses |
beetsplug/deezer.py | Add search_limit config and enforce limit on API responses |
beetsplug/musicbrainz.py | Rename searchlimit to search_limit with backward compatibility |
docs/plugins/spotify.rst | Document new search_limit configuration option |
docs/plugins/deezer.rst | Document new search_limit configuration option |
docs/plugins/musicbrainz.rst | Update documentation for renamed option with deprecation notice |
docs/changelog.rst | Update historical reference to use new option name |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5960 +/- ##
==========================================
- Coverage 66.70% 66.49% -0.21%
==========================================
Files 117 117
Lines 18112 18119 +7
Branches 3070 3070
==========================================
- Hits 12081 12048 -33
- Misses 5374 5415 +41
+ Partials 657 656 -1
🚀 New features to boost your workflow:
|
a770a2f
to
2ef87b7
Compare
Maybe we want to add this to the MetadataPlugin abc? Seems like logic for how many candidates are returned should be handled by every metadata plugin. Does it make a difference from an api calling perspective for the deezer and spotify endpoint i.e. do we use less api calls if we limit the returned candidate? Alternatively, we could also have one global config for this e.g. |
It doesn't look like it in this implementation - full results are fetched and then simply cut off. So there shouldn't be an actual difference in performance.
Do you mean that a global option sets all source plugins in use to one value always, eg sets a limit of 5 to all of them always? This wouldn't be a good idea in my opinion since I often had the feeling that some sources benefit from having more results available to the user than others. So individual config possiblity per source plugin should be kept I think. I think we should merge this PR as-is since most of all it is a streamlining of options. Moving some to metadata source plugin after that. And you are the expert for that @semohr :-) |
Now i was curious and investigated how for example the Discogs plugin handles that seach_limit option. In that case it does limit the api calls in the first place since that Lines 251 to 255 in 6c21482
So handling this is on a per source plugin basis I think and what this PR does is ok for now but if the libs we use support it, it could be improved. Too lazy right now to look into what deezer and spotify libs (if we use any) support. Let's merge this and keep an issue open as a reminder? What do you all think? |
We would still have distinct options for each plugin but would handle the configuration option/logic more globally and generic. For example we use the same approach for the beets/beets/metadata_plugins.py Line 151 in 6c21482
Agreed |
I opened that reminder issue just now. But would adding a simple line like this already be a win in that abstract class (and removing it from the plugins in this PR)?
Then we could as well add it already. Or should there be more to it in the first place? |
2ef87b7
to
ccb2f5d
Compare
Sorry for hijacking @snejus , I fixed that conflict in spotify.py and force-pushed. Hope you don't mind 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include option in abc now or later @snejus ? other than that, ready to merge I guess.
ccb2f5d
to
a674fd3
Compare
|
Relatedly, I started work on centralising the entire search functionality in these autotaggers: #5982 |
search_limit
option to Deezer and Spotify plugins (default 5) and enforce it when returning search results.musicbrainz.searchlimit
tomusicbrainz.search_limit
(old key still read with deprecation warning; slated for removal in 3.0.0).