autotagging: make Change polymorphic#6689
Open
snejus wants to merge 4 commits into
Open
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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## introduce-source #6689 +/- ##
=================================================
Coverage 72.60% 72.60%
=================================================
Files 163 163
Lines 20811 20812 +1
Branches 3288 3287 -1
=================================================
+ Hits 15109 15110 +1
Misses 4978 4978
Partials 724 724
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
grug see PR make import preview use one show_change() path for album and track. This fits import UI by moving display choice into Change.from_match() and show() methods.
Changes:
- Rename shared preview object to
Changeand add factory for album vs track match. - Move album tracklist display methods onto
AlbumChange. - Simplify import session calls to always use
show_change().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
beets/ui/commands/import_/display.py |
Adds polymorphic change display flow and album/track subclasses. |
beets/ui/commands/import_/session.py |
Removes track-specific preview branch and calls shared display entry point. |
e4bac3a to
d26e8f2
Compare
d26e8f2 to
1952f55
Compare
1952f55 to
97e8a4f
Compare
97e8a4f to
90e087b
Compare
90e087b to
3827a35
Compare
3827a35 to
d466ca8
Compare
d466ca8 to
8668ec6
Compare
8668ec6 to
5e3860a
Compare
5e3860a to
609a54c
Compare
Introduce Source class to encapsulate metadata extraction logic, replacing scattered `get_most_common_tags` calls throughout codebase. - Add Source class in importer.tasks with artist, name, and metadata - Simplify `distance()` to accept Source.data instead of items list - Update display functions to use Source objects - Cache Source creation with @cached_property on ImportTask This centralizes metadata handling and reduces coupling between autotag and library modules.
- Route both album and track preview output through one show_change path with polymorphic Change helpers. - Removes duplicate branching in session prompts and keeps preview rendering behavior centralized.
609a54c to
e30f69a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6688
This change simplifies import preview rendering by routing both album and track matches through a single
show_change()flow.Architectural impact
Change.from_match()factory that selectsAlbumChangeorTrackChangebased on the match type.show()methods, so each change type owns its own display behavior.show_item_change()and the related branching insession.py.High-level effect
beets/ui/commands/import_/display.py.session.pysimpler by using one preview entry point for both albums and tracks.In short: this refactor does not change the import flow itself, but it makes the change-display architecture more uniform, easier to follow, and easier to extend.