Your First Import
Outcome: a folder of music files
becomes a small library — database
populated, files re-filed into a tidy
tree — using the as-is mode that asks
no questions and touches no network.
The lab's version of this chapter is
transcript t02-first-import-asis.txt.
The smallest useful config
Beets needs to be told two places before it can work: where the database lives and where the music goes. The lab's whole config, minus the plugin lines chapter 9 adds, is:
directory: /home/you/music/library
library: /home/you/music/library.db
import:
copy: yes
write: yes
copy: yes is the safe default for a
first import: the originals stay
where they were, and beets copies
them into directory under its own
layout. (The alternatives — move,
or importing files in place with
-C — have their place once you
trust the tool; chapter 10 uses
them deliberately.) write: yes
lets beets keep the tags inside the
files in step with the database.
Meeting the fixtures
The lab imported three small albums,
generated as tones and tagged with
invented artists (beets-lab/make-fixtures.sh
builds them): two by The Lab Tones —
one deliberately carrying a misspelled
album name, First Experimnets, for
chapter 6 to fix — and one FLAC album
by Ada Volt & The Resistors. Files
arrived with workable names in dull
folders (album-a/track01.mp3 and
the like). Yours will be whatever
your ripper left; the import does
not care, because it reads tags, not
filenames.
The import
beet import -A incoming/album-a incoming/album-a-typo incoming/album-b
-A is --noautotag: take the tags
as they are. Beets prints each folder
as it works through it, and stays
silent about the tracks themselves
unless something needs a decision —
with as-is import, nothing does.
The check: the tree
find library -type f | sort
library/Ada Volt & The Resistors/Ohm Sweet Ohm/01 Current Affairs.flac
library/Ada Volt & The Resistors/Ohm Sweet Ohm/02 Ground Loop Blues.flac
library/The Lab Tones/First Experiments/01 Sine Wave Sunrise.mp3
library/The Lab Tones/First Experiments/02 Triangle at Noon.mp3
library/The Lab Tones/First Experiments/03 Quiet Static.mp3
library/The Lab Tones/First Experiments/cover.jpg
library/The Lab Tones/First Experimnets/04 Sine Wave Sunrise (Reprise).mp3
Read it slowly, because this one listing teaches three rules:
- The layout came from the tags,
not the source folders. Files
that arrived as
track01.mp3inalbum-a/are now01 Sine Wave Sunrise.mp3under folders named for their artist and album tags. - A picture in the folder came
along. The lab put a
cover.jpgbeside the first album's files; beets carried it into the album's new folder and noted it as the album's art (chapter 9 explores this properly). - A bad tag files things badly, faithfully. The misspelled album is its own folder, because as-is means as-is. That is not a failure of the import; it is the import showing you your tags. Chapter 6 fixes it in the database and has the files follow.
The database half of the check is
one command away: beet ls should
list every track the tree shows
(chapter 5). If a file is in the
tree but not in beet ls, or the
other way round, something
interrupted the import — chapter 13
takes it from there.