beets icon indicating copy to clipboard operation
beets copied to clipboard

mbsync: Don't overwrite genres from MusicBrainz while the underlying library does not support them

Open tandy-1000 opened this issue 4 years ago • 15 comments

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.

tandy-1000 avatar Sep 22 '21 20:09 tandy-1000

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

sampsyo avatar Sep 23 '21 11:09 sampsyo

please clarify how the genres config option affects this behavior in the mbsync plugin currently (if at all)?

Currently there is no effect, the MBSync plugin doesn't actually have any configuration options it seems.

tandy-1000 avatar Sep 23 '21 16:09 tandy-1000

I also want to say that I would be happy to take this on, if you could offer some guidance

tandy-1000 avatar Sep 23 '21 16:09 tandy-1000

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?

sampsyo avatar Sep 23 '21 20:09 sampsyo

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?

Yep, that's where I've got it.

tandy-1000 avatar Sep 24 '21 12:09 tandy-1000

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.

sampsyo avatar Sep 25 '21 16:09 sampsyo

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?

tandy-1000 avatar Sep 25 '21 17:09 tandy-1000

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

tandy-1000 avatar Sep 25 '21 17:09 tandy-1000

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.

tandy-1000 avatar Sep 25 '21 19:09 tandy-1000

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…

sampsyo avatar Sep 25 '21 21:09 sampsyo

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?

tandy-1000 avatar Sep 25 '21 21:09 tandy-1000

Or perhaps even more simply, it would be good to avoid clobbering any existing genres if the ones fetched from MusicBrainz are empty...

sampsyo avatar Sep 26 '21 02:09 sampsyo

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.

stale[bot] avatar Nov 26 '21 00:11 stale[bot]

please reopen !

tandy-1000 avatar Dec 03 '21 20:12 tandy-1000

Thanks; this should probably be marked as a bug (to do the clobber-avoidance thing).

sampsyo avatar Dec 03 '21 22:12 sampsyo