Conversation
|
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. |
There was a problem hiding this comment.
Pull request overview
PR make lastgenre Last.fm client API smaller. Instead of 3 fetch funcs, now one fetch(kind, obj) dispatch table, and plugin call sites updated to use it.
Changes:
- Add
LastFmClient.FETCH_METHODSregistry and newfetch(kind, obj)dispatcher. - Inline old tag parsing into
fetch_genresand remove old per-entity fetch methods. - Update plugin + tests to use new fetch API and simpler mocking.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| beetsplug/lastgenre/client.py | Add unified fetch dispatch + simplify tag fetch/filter path |
| beetsplug/lastgenre/init.py | Switch genre resolution stages to call client.fetch(kind, obj) |
| test/plugins/test_lastgenre.py | Update tests to new API + monkeypatch LastFmClient.fetch |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6495 +/- ##
=======================================
Coverage 70.40% 70.40%
=======================================
Files 148 148
Lines 18806 18798 -8
Branches 3067 3066 -1
=======================================
- Hits 13240 13235 -5
+ Misses 4916 4913 -3
Partials 650 650
🚀 New features to boost your workflow:
|
a2e3036 to
570bb75
Compare
|
@JOJ0 I also added you as the lastgenre codeowner :) |
|
@snejus please rebase on master and let's get this in. That's the simplification you mentioned a while ago! Great! Thanks! |
ece5ae5 to
1fd4d03
Compare
Delegate the responsibility of getting relevant model fields to the client by declaring the genre fetching spec on the class.
This issue has been resolved in 2014.
1fd4d03 to
263ae8f
Compare
Consolidate Last.fm genre fetching into a single
fetchmethodThis PR simplifies the
lastgenreclient API by replacing three separate fetch methods (fetch_track_genre,fetch_album_genre,fetch_artist_genre) with a single unifiedfetch(kind, obj)method.What changed
client.py:FETCH_METHODSregistry (ClassVardict) mapping fetch "kinds" ("track","album","artist","album_artist") to a(pylast_method, arg_extractor)tuple.fetch_*methods with a singlefetch(kind, obj)that dispatches via this registry._tags_forwrapper — its logic is inlined into the now-publicfetch_genres.pylast.Album.get_top_tags()inconsistency fixed in 2014.__init__.py:client.fetch(kind, obj)— the client now owns field extraction (e.g.obj.artist,obj.album), removing that concern from the plugin layer.test_lastgenre.py:monkeypatchonLastFmClient.fetchreplaces three separate method patches.Impact