Skip to content

Recipes

Outcome: four small routines that cover most of a beets library's ongoing life — intake, playlists, a monthly sweep, and a catalogue you can hand to something else. Each is built only from commands the earlier chapters verified; where a recipe leans on a plugin the lab did not run, it says so.

1. The intake routine, for new arrivals

Keep an incoming folder that is not the library, and treat importing as a small ceremony rather than a reflex:

# 1. look first — import reports what it would take in
beet import --pretend incoming/

# 2. take it in as-is if the tags are already decent,
#    or without -A if they need MusicBrainz (chapter 7)
beet import -A incoming/

# 3. glance at the shape of things
beet stats
beet ls -a

The --pretend step is the recipe's soul: it rehearses the import — grouping, paths, clashes — and changes nothing, so the album that would have split in two (chapter 6) is visible before it does. The ls -a in the last line is the review habit from chapter 5: new arrivals that split an album in two show up there while the fixing is still a five-minute job.

2. A playlist from a question

Any query can become a playlist, because a playlist is just a list of paths:

beet ls -f '$path' albumartist:"The Lab Tones"
.../library/The Lab Tones/First Experiments/01 Sine Wave Sunrise.mp3
.../library/The Lab Tones/First Experiments/02 Triangle at Noon.mp3

Send it to a file with your shell's > and most players will open it as an .m3u. The format string is the whole API: add a field, change the query, and the playlist is a different slice of the same library. (The smartplaylist plugin automates exactly this — regenerating named playlists on a schedule — and is documented-only here; the manual form above is what it automates.)

3. The monthly sweep

Fifteen minutes, four commands, in this order:

beet stats                                   # the shape of things
beet duplicates -k albumartist -k album -k title
beet ls -a                                   # read it: splits hide here
beet fetchart                                # art for anything missing it

The duplicates line uses the tag keys on purpose — chapter 8 showed why the defaults and the checksums each miss their quarry in a loved library. Read the ls -a output the way chapter 5 taught: an artist appearing under two spellings, or an album listed twice, is next month's chapter-6 job, noticed while it is still small. Nothing in the sweep deletes anything; it produces a list of decisions, which is the correct output of a monthly routine.

4. The catalogue, for other tools

When another program needs to know what you own, do not hand it the folder tree — hand it the database's answer, shaped with -f:

beet ls -f '$albumartist|$album|$track|$title|$length|$path'

One line per track, fields separated cleanly, ready for a spreadsheet, a diff against a friend's export, or the web plugin's JSON (chapter 9) when the consumer would rather make requests than read files. The habit to keep is the direction of travel: the database is the catalogue, the folder tree is a filing detail, and recipes that remember which is which do not break when you change your path formats.