beetbox / beetbox/beets

Musicbrainz fields should not be overwritten by non-MB data

Open
#4,797 3 comments 0 reactions 0 assignees View on GitHub
musicbrainz
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

There are several Musicbrainz (MB) fields `mb_*` that are currently being overwritten by non-MB data. This does not make sense. Now, I understand that many of those choices were made given that MB was the only tag source and beets was designed around MB. However, now we have several other tag sources. Thus, non-MB sources should not touch `mb_*` fields, especially if the MB fields already have valid data.

Here's the logic that we should follow:

1. During the initial import (even by non-MB sources), it is fine to populate `mb_*` field as we cannot have them empty.
2. During re-imports, we should not overwrite these fields unless they are from MB.

Based on my understanding, we need to add additional checks in the `apply_item_metadata`:
https://github.com/beetbox/beets/blob/a19bc0570cd462aa8c978634fa82b1049330fcd1/beets/autotag/__init__.py#L76

and the `apply_metadata` functions
https://github.com/beetbox/beets/blob/a19bc0570cd462aa8c978634fa82b1049330fcd1/beets/autotag/__init__.py#L100
before overwriting `mb_*` fields.

Would love your thoughts on this and possibly a quick fix.

Contributor guide

Open the contributing guide

Research direction

Start in beets/autotag/__init__.py at apply_item_metadata and apply_metadata. Trace how the source is identified during initial imports and re-imports, then verify the existing metadata behavior around mb_* fields. Done means initial imports can populate these fields, while non-MusicBrainz re-imports preserve valid mb_* data and MusicBrainz updates remain possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.