beets
beets copied to clipboard
mbsync: Don't overwrite genres from MusicBrainz while the underlying library does not support them
Proposed solution
At the moment, the MBSync plugin will overwrite the genre field to empty, expected behaviour would be to update this information, this could be done using code from the musicbrainz plugin. While improving this functionality, another useful feature would be to add the ability to append to genres, rather than overwriting them.
Objective
- [ ] Add ability to update genres from musicbrainz via musicbrainz plugin
- [ ] Add option to overwrite or append to genres
Goals
Users can use the MBSync plugin while also using the other genre collecting plugins.
Hi! Sounds mostly reasonable, but can you please clarify how the genres config option affects this behavior in the mbsync plugin currently (if at all)?
https://github.com/beetbox/beets/blob/7ae8b9c3f076e4f31c37a8922d083441691d158b/beets/config_default.yaml#L110
please clarify how the
genresconfig option affects this behavior in thembsyncplugin currently (if at all)?
Currently there is no effect, the MBSync plugin doesn't actually have any configuration options it seems.
I also want to say that I would be happy to take this on, if you could offer some guidance
To be clear, this doesn’t go in the config section for the plugin. It goes in the top-level musicbrainz section, as demonstrated by the file linked above. Can you give that a shot?
To be clear, this doesn’t go in the config section for the plugin. It goes in the top-level
musicbrainzsection, as demonstrated by the file linked above. Can you give that a shot?
Yep, that's where I've got it.
Got it. I'm really not sure why that would be—I would expect the MusicBrainz data to contain genres if that setting is enabled.
In any case, if you're interested in looking into this, the place to fix it would be in mbsync.py. Somewhere after we fetch the metadata:
https://github.com/beetbox/beets/blob/7ae8b9c3f076e4f31c37a8922d083441691d158b/beetsplug/mbsync.py#L116
But before we apply it to the database: https://github.com/beetbox/beets/blob/7ae8b9c3f076e4f31c37a8922d083441691d158b/beetsplug/mbsync.py#L156
…we'd want to remove any genre information from the album_info object so it doesn't overwrite what's already there. But we'd probably want to be sensitive to the aforementioned genres config option and allow overwriting when that's enabled.
Got it. I'm really not sure why that would be—I would expect the MusicBrainz data to contain genres if that setting is enabled.
I seem to recall reading that this was an unreleased feature in musicbrainzngs, could that be why?
I found the PR https://github.com/alastair/python-musicbrainzngs/pull/266/, I need to figure out how compile it and try with that PR
I found the PR alastair/python-musicbrainzngs#266, I need to figure out how compile it and try with that PR
Okay, with the PR compiled, it works, genres are grabbed. The only thing that is a shame is that musicbrainz and whatlastgenre use different naming schemes, 'pop' and 'Pop'. So I need to make a PR to https://github.com/YetAnotherNerd/whatlastgenre/ to improve this so that it uses a genre schema more suitable for working with musicbrainz. Also a couple other fixes such as making the redacted backend work again.
I guess it would be good to fix beets so that it doesn't clobber genres before that PR is released in the Python library…
I guess it would be good to fix beets so that it doesn't clobber genres before that PR is released in the Python library…
yes, maybe we should do some sort of merge?
Or perhaps even more simply, it would be good to avoid clobbering any existing genres if the ones fetched from MusicBrainz are empty...
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
please reopen !
Thanks; this should probably be marked as a bug (to do the clobber-avoidance thing).