Skip to content

Fixing Tags

Outcome: a misspelled album name is corrected everywhere it matters — track records, the album record, the tags inside the files, and the folder names — and you understand the one surprise beets keeps for people who skip this chapter: tracks and albums are separate records, and renaming one does not merge the other. Transcripts t04 through t06 and t11 are this chapter's evidence.

modify: change a value

beet modify QUERY field=value changes fields on the tracks a query matches, and writes the change into the files' tags as well as the database. It shows you a diff and asks first; --yes answers in advance, which the lab used and a careful human often should not.

The lab's patient is the reprise track filed under the misspelled First Experimnets:

beet modify --yes album:"First Experimnets" album="First Experiments"
Modifying 1 items.
The Lab Tones - First Experimnets - Sine Wave Sunrise (Reprise)
  album: First Experimnets -> First Experiments

Done — except for what beet ls -a reveals next: both albums still exist. The track's field changed, but the track belongs to an album record, and that record kept its own name. Beets keeps album-level fields (the album's title, its artist, its year) on the album, and track fields on the tracks; modify without -a edits tracks only.

The album is a record too

Add -a and the same command edits albums:

beet modify -a --yes album:"First Experimnets" album="First Experiments"
Modifying 1 albums.
The Lab Tones - First Experimnets
  album: First Experimnets -> First Experiments

Now beet ls -a shows two albums, both correctly named First Experiments — and there the renaming road ends. They are two records that happen to share a name, because they were born as two imports. The lab then tried to merge them the way the importer offers (transcript t05-merge-attempt.txt): removing the stray track from the database and re-importing its file, answering the "This album is already in the library!" prompt with Merge all. The track landed as its own album record anyway, with a fresh album_id to prove it — and setting import.duplicate_action: merge in the config beforehand changed nothing. In beets 2.14.1, the importer's merge is for true duplicates of the same tracks; it does not pour one album's tracks into another album record. Honest conclusion: beets has no merge command for album records, and any guide that implies a rename does it is skipping a step.

move: make the files follow

Renames change the database at once; the files keep their old paths until beet move re-files them according to the path formats:

beet move

Watch what it does with the lab's pair of same-named albums:

library/The Lab Tones/First Experiments [1]/01 Sine Wave Sunrise.mp3
library/The Lab Tones/First Experiments [2]/04 Sine Wave Sunrise (Reprise).mp3

That is %aunique{} from chapter 2 at work: two records, one name, so the folders are numbered to keep them apart. It looks like clutter and is actually a warning label — numbered folders mean the database holds the album twice.

Reuniting an album, the reliable way

Transcript t06-reuniting-an-album.txt is the fix that works, and it is worth learning as a pattern:

  1. Remove the album records from the database, keeping the files: beet remove -a -f albumartist:"The Lab Tones" (no -d, so no file is deleted).
  2. Gather the corrected tracks into one folder — the files' tags were already fixed by modify, which writes tags as it goes; ffprobe in the transcript shows the fixed album name inside the stray file.
  3. Import that folder as one album: beet import -A reunited/.
  4. Tidy the orphaned numbered folders the old records left behind, which are no longer in the database and are ordinary files to delete.

The result is one album record, one folder with the plain name, and beet ls showing all four tracks under it. The lesson generalises: in beets, an album is the set of tracks an import created together, and surgery on that grouping is done with remove and re-import, not with renames.

update: when files change behind beets' back

The last tool in this chapter runs the other direction. If another program edits your files' tags, beet update re-reads the files (beets notices them by modification time) and brings the database up to date. Mostly it works exactly like that. Transcript t11-update.txt documents the exception the lab found in 2.14.1: for the multi-value genres field, update reports the change — correctly, in a clear diff — but does not store it, and reports the same diff forever. The workaround is in the same transcript: set the field with beet modify, which writes database and file together, after which update falls silent. Treat this the way the lab does: a known, narrow defect in one field, in one version — and a good reason to verify a fix with beet ls instead of trusting the diff you were shown.