-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Refresh flexible MusicBrainz metadata on reimport #6064
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
…ta from new releases replaces stale values
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 addresses issue #6036 by ensuring that flexible MusicBrainz metadata fields are refreshed during reimport operations, allowing format changes to be properly applied.
- Adds specific MusicBrainz fields to the reimport fresh fields lists
- Implements automatic extension of reimport fresh fields during plugin initialization
- Updates changelog to document the bug fix
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/changelog.rst | Documents the bug fix for refreshing flexible MusicBrainz metadata on reimport |
| beetsplug/musicbrainz.py | Implements the core functionality to extend reimport fresh fields with MusicBrainz-specific fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
snejus
left a comment
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.
We need a different approach - this is not a good idea
|
Do we want to rewrite this now? Sadly the current logic is how it was intended for some reason originally. It alsso seems a bit strange to me that we have to define these field in the first place. An opt out list would be more appropriet. We should also check why and when this was introduced. |
|
We can (and should) simply extend those list constants explicitly with new fields. They aren't specific to |
AFAIR this is an opt out list: Everything should always be refreshed on a reimport, except not for those fields (because it would be just wrong for them)
I introduced this a couple of years ago. Not much time right now to reread what was all the reasons back then but I at least looked up the PR for you guys :-) #4735 |
|
I think I see this logic in play in my |
Explicitly! Yes please! Keep it readable. If there would be something that is absolutely plugin specific, we could simply note it in a comment? |
exactly! this is it! |
|
For now, I think, we can just extend those lists and merge this PR. Longer term, we need to find why flexible attribute update logic differs from db attribute update. DB attributes are always updated with values other than |
|
Here's another discussion on this topic #4788 So, how do we want to resolve this PR? I am happy if one of you would like to take this forward. |
|
@snejus, I have updated the list for now. We can merge this for now and have a separate discussion about the changes required to fix the underlying issue. It may also not be a bad idea for you to fix this in #6052 |
snejus
left a comment
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.
Remove these changes from musicbrainz.py and add the fields to the lists in importer.tasks instead.
|
@snejus check now. This may be beyond the scope of the current PR, but I assume that title, album, albumartist, etc. are still not updated on reimport. I don't see any reason why that should be the case. Like you said
|
|
@arsaboo it's impossible to have a flexible attribute named after any of the database fields. If you try to set def _setitem(self, key, value):
"""Assign the value for a field, return whether new and old value
differ.
"""
# Choose where to place the value.
if key in self._fields:
source = self._values_fixed
else:
source = self._values_flex
|
…M and REIMPORT_FRESH_FIELDS_ALBUM definitions
Before merging, could you please create an issue summarizing the situation, what’s different, and how or why we might want to change it? That way we can keep track of it and organize our thoughts for future work. 😉 |
HAHA....I wish I had that clarity 🤣 I honestly did not even completely follow @snejus comment. @JOJ0 and @snejus are the closest to this, and I will let them summarize and resolve this in a subsequent PR. |
|
I kinda lost the sauce too. That's why im asking :D |
|
I often fail to communicate properly... I hope that this helps, guys, see: https://www.perplexity.ai/search/can-you-explain-what-is-snejus-eO3.NbE8TM.d.1FOARnPqA |
It was not your explanation, but my lack of understanding. This helps. To summarize (and for posterity), Database Fields vs. Flexible Attributes: Beets treats two types of fields differently: Database Fields (_values_fixed):
Flexible Attributes (_values_flex)
The REIMPORT_FRESH_FIELDS lists act as an allowlist - only flexible attributes in these lists get updated during reimport, while all others are preserved. Let me know if anything else is required in this PR. |
|
There's no need to add |
snejus
left a comment
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.
Thanks for your patience @arsaboo. We ended up having a very involved discussion relative to the size of this tiny change.
This only proves that this is one of the most complicated and opaque parts of the codebase and that we need to prioritize improving this to make it clearer to everyone.
Thanks for patiently explaining the issue. I feel I have a (slightly) better understanding :) |

Fixes #6036
docs/changelog.rstto the bottom of one of the lists near the top of the document.)