Debian Codegraph @

docs/reference/config.rst

raw
1 Configuration
2 =============
3
4 Beets has an extensive configuration system that lets you customize nearly every
5 aspect of its operation. To configure beets, you create a file called
6 ``config.yaml``. The location of the file depends on your platform (type ``beet
7 config -p`` to see the path on your system):
8
9 - On Unix-like OSes, write ``~/.config/beets/config.yaml``.
10 - On Windows, use ``%APPDATA%\beets\config.yaml``. This is usually in a
11 directory like ``C:\Users\You\AppData\Roaming``.
12 - On OS X, you can use either the Unix location or ``~/Library/Application
13 Support/beets/config.yaml``.
14
15 You can launch your text editor to create or update your configuration by typing
16 ``beet config -e``. (See the :ref:`config-cmd` command for details.) It is also
17 possible to customize the location of the configuration file and even use
18 multiple layers of configuration. See `Configuration Location`_, below.
19
20 The config file uses YAML_ syntax. You can use the full power of YAML, but most
21 configuration options are simple key/value pairs. This means your config file
22 will look like this:
23
24 ::
25
26 option: value
27 another_option: foo
28 bigger_option:
29 key: value
30 foo: bar
31
32 In YAML, you will need to use spaces (not tabs!) to indent some lines. If you
33 have questions about more sophisticated syntax, take a look at the YAML_
34 documentation.
35
36 .. _yaml: https://yaml.org/
37
38 The rest of this page enumerates the dizzying litany of configuration options
39 available in beets. You might also want to see an :ref:`example
40 <config-example>`.
41
42 .. contents::
43 :local:
44 :depth: 2
45
46 Global Options
47 --------------
48
49 These options control beets' global operation.
50
51 library
52 ~~~~~~~
53
54 Path to the beets library file. By default, beets will use a file called
55 ``library.db`` alongside your configuration file.
56
57 directory
58 ~~~~~~~~~
59
60 The directory to which files will be copied/moved when adding them to the
61 library. Defaults to a folder called ``Music`` in your home directory.
62
63 tempfile_prefix
64 ~~~~~~~~~~~~~~~
65
66 The prefix used for temporary files when moving files across filesystems. If
67 unset, temporary files use a leading dot (``.``). This can be changed when
68 moving files to a Windows or Samba share, where a leading dot may cause the file
69 to be treated as hidden.
70
71 editor
72 ~~~~~~
73
74 The text editor to use when editing configuration files (e.g., via ``beet config
75 -e``). Overrides the ``$VISUAL`` and ``$EDITOR`` environment variables. If none
76 of these are set, beets falls back to the platform default. Example:
77
78 ::
79
80 editor: nano
81
82 create_backup_before_migrations
83 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
85 Either ``yes`` or ``no``, indicating whether a backup of the database file
86 should be created before applying any pending schema migrations after a beets
87 upgrade. The backup is only made when there are actually migrations to run.
88 Defaults to ``yes``.
89
90 .. _plugins-config:
91
92 plugins
93 ~~~~~~~
94
95 A space-separated list of plugin module names to load. See :ref:`using-plugins`.
96
97 include
98 ~~~~~~~
99
100 A space-separated list of extra configuration files to include. Filenames are
101 relative to the directory containing ``config.yaml``.
102
103 pluginpath
104 ~~~~~~~~~~
105
106 Directories to search for plugins. Each Python file or directory in a plugin
107 path represents a plugin and should define a subclass of |BeetsPlugin|. A plugin
108 can then be loaded by adding the plugin name to the ``plugins`` configuration.
109 The plugin path can either be a single string or a list of strings---so, if you
110 have multiple paths, format them as a YAML list like so:
111
112 ::
113
114 pluginpath:
115 - /path/one
116 - /path/two
117
118 .. _ignore:
119
120 ignore
121 ~~~~~~
122
123 A list of glob patterns specifying file and directory names to be ignored when
124 importing. By default, this consists of ``.*``, ``*~``, ``System Volume
125 Information``, ``lost+found`` (i.e., beets ignores Unix-style hidden files,
126 backup files, and directories that appears at the root of some Linux and Windows
127 filesystems).
128
129 .. _ignore_hidden:
130
131 ignore_hidden
132 ~~~~~~~~~~~~~
133
134 Either ``yes`` or ``no``; whether to ignore hidden files when importing. On
135 Windows, the "Hidden" property of files is used to detect whether or not a file
136 is hidden. On OS X, the file's "IsHidden" flag is used to detect whether or not
137 a file is hidden. On both OS X and other platforms (excluding Windows), files
138 (and directories) starting with a dot are detected as hidden files.
139
140 .. _replace:
141
142 replace
143 ~~~~~~~
144
145 A set of regular expression/replacement pairs to be applied to all filenames
146 created by beets. Typically, these replacements are used to avoid confusing
147 problems or errors with the filesystem (for example, leading dots, which hide
148 files on Unix, and trailing whitespace, which is illegal on Windows). To
149 override these substitutions, specify a mapping from regular expression to
150 replacement strings. For example, ``[xy]: z`` will make beets replace all
151 instances of the characters ``x`` or ``y`` with the character ``z``.
152
153 If you do change this value, be certain that you include at least enough
154 substitutions to avoid causing errors on your operating system. Here are the
155 default substitutions used by beets, which are sufficient to avoid unexpected
156 behavior on all popular platforms:
157
158 ::
159
160 replace:
161 '[\\/]': _
162 '^\.': _
163 '[\x00-\x1f]': _
164 '[<>:"\?\*\|]': _
165 '\.$': _
166 '\s+$': ''
167 '^\s+': ''
168 '^-': _
169
170 These substitutions remove forward and back slashes, leading dots, and control
171 characters—all of which is a good idea on any OS. The fourth line removes the
172 Windows "reserved characters" (useful even on Unix for compatibility with
173 Windows-influenced network filesystems like Samba). Trailing dots and trailing
174 whitespace, which can cause problems on Windows clients, are also removed.
175
176 When replacements other than the defaults are used, it is possible that they
177 will increase the length of the path. In the scenario where this leads to a
178 conflict with the maximum filename length, the default replacements will be used
179 to resolve the conflict and beets will display a warning.
180
181 Note that paths might contain special characters such as typographical quotes
182 (``“”``). With the configuration above, those will not be replaced as they don't
183 match the typewriter quote (``"``). To also strip these special characters, you
184 can either add them to the replacement list or use the :ref:`asciify-paths`
185 configuration option below.
186
187 .. _path-sep-replace:
188
189 path_sep_replace
190 ~~~~~~~~~~~~~~~~
191
192 A string that replaces the path separator (for example, the forward slash ``/``
193 on Linux and MacOS, and the backward slash ``\\`` on Windows) when generating
194 filenames with beets. This option is related to :ref:`replace`, but is distinct
195 from it for technical reasons.
196
197 .. warning::
198
199 Changing this option is potentially dangerous. For example, setting it to
200 the actual path separator could create directories in unexpected locations.
201 Use caution when changing it and always try it out on a small number of
202 files before applying it to your whole library.
203
204 Default: ``_``.
205
206 .. _asciify-paths:
207
208 asciify_paths
209 ~~~~~~~~~~~~~
210
211 Convert all non-ASCII characters in paths to ASCII equivalents.
212
213 For example, if your path template for singletons is ``singletons/$title`` and
214 the title of a track is "Café", then the track will be saved as
215 ``singletons/Cafe.mp3``. The changes take place before applying the
216 :ref:`replace` configuration and are roughly equivalent to wrapping all your
217 path templates in the ``%asciify{}`` :ref:`template function
218 <template-functions>`.
219
220 This uses the `unidecode module <https://pypi.org/project/Unidecode>`__ which is
221 language agnostic, so some characters may be transliterated from a different
222 language than expected. For example, Japanese kanji will usually use their
223 Chinese readings.
224
225 Default: ``no``.
226
227 .. _art-filename:
228
229 art_filename
230 ~~~~~~~~~~~~
231
232 When importing album art, the name of the file (without extension) where the
233 cover art image should be placed. This is a template string, so you can use any
234 of the syntax available to :doc:`/reference/pathformat`. Defaults to ``cover``
235 (i.e., images will be named ``cover.jpg`` or ``cover.png`` and placed in the
236 album's directory).
237
238 threaded
239 ~~~~~~~~
240
241 Either ``yes`` or ``no``, indicating whether the autotagger should use multiple
242 threads. This makes things substantially faster by overlapping work: for
243 example, it can copy files for one album in parallel with looking up data in
244 MusicBrainz for a different album. You may want to disable this when debugging
245 problems with the autotagger. Defaults to ``yes``.
246
247 .. _format_item:
248
249 .. _list_format_item:
250
251 format_item
252 ~~~~~~~~~~~
253
254 Format to use when listing *individual items* with the :ref:`list-cmd` command
255 and other commands that need to print out items. Defaults to ``$artist - $album
256 - $title``. The ``-f`` command-line option overrides this setting.
257
258 It used to be named ``list_format_item``.
259
260 .. _format_album:
261
262 .. _list_format_album:
263
264 format_album
265 ~~~~~~~~~~~~
266
267 Format to use when listing *albums* with :ref:`list-cmd` and other commands.
268 Defaults to ``$albumartist - $album``. The ``-f`` command-line option overrides
269 this setting.
270
271 It used to be named ``list_format_album``.
272
273 .. _sort_item:
274
275 sort_item
276 ~~~~~~~~~
277
278 Default sort order to use when fetching items from the database. Defaults to
279 ``artist+ album+ disc+ track+``. Explicit sort orders override this default.
280
281 .. _sort_album:
282
283 sort_album
284 ~~~~~~~~~~
285
286 Default sort order to use when fetching albums from the database. Defaults to
287 ``albumartist+ album+``. Explicit sort orders override this default.
288
289 .. _sort_case_insensitive:
290
291 sort_case_insensitive
292 ~~~~~~~~~~~~~~~~~~~~~
293
294 Either ``yes`` or ``no``, indicating whether the case should be ignored when
295 sorting lexicographic fields. When set to ``no``, lower-case values will be
296 placed after upper-case values (e.g., *Bar Qux foo*), while ``yes`` would result
297 in the more expected *Bar foo Qux*. Default: ``yes``.
298
299 .. _original_date:
300
301 original_date
302 ~~~~~~~~~~~~~
303
304 Either ``yes`` or ``no``, indicating whether matched albums should have their
305 ``year``, ``month``, and ``day`` fields set to the release date of the
306 *original* version of an album rather than the selected version of the release.
307 That is, if this option is turned on, then ``year`` will always equal
308 ``original_year`` and so on. Default: ``no``.
309
310 .. _overwrite_null:
311
312 overwrite_null
313 ~~~~~~~~~~~~~~
314
315 This confusingly-named option indicates which fields have meaningful ``null``
316 values. If an album or track field is in the corresponding list, then an
317 existing value for this field in an item in the database can be overwritten with
318 ``null``. By default, however, ``null`` is interpreted as information about the
319 field being unavailable, so it would not overwrite existing values. For example:
320
321 ::
322
323 overwrite_null:
324 album: ["albumid"]
325 track: ["title", "date"]
326
327 .. _artist_credit:
328
329 artist_credit
330 ~~~~~~~~~~~~~
331
332 Either ``yes`` or ``no``, indicating whether matched tracks and albums should
333 use the artist credit, rather than the artist. That is, if this option is turned
334 on, then ``artist`` will contain the artist as credited on the release.
335
336 .. _per_disc_numbering:
337
338 per_disc_numbering
339 ~~~~~~~~~~~~~~~~~~
340
341 A boolean controlling the track numbering style on multi-disc releases. By
342 default (``per_disc_numbering: no``), tracks are numbered per-release, so the
343 first track on the second disc has track number N+1 where N is the number of
344 tracks on the first disc. If this ``per_disc_numbering`` is enabled, then the
345 first (non-pregap) track on each disc always has track number 1.
346
347 If you enable ``per_disc_numbering``, you will likely want to change your
348 :ref:`path-format-config` also to include ``$disc`` before ``$track`` to make
349 filenames sort correctly in album directories. For example, you might want to
350 use a path format like this:
351
352 ::
353
354 paths:
355 default: $albumartist/$album%aunique{}/$disc-$track $title
356
357 When this option is off (the default), even "pregap" hidden tracks are numbered
358 from one, not zero, so other track numbers may appear to be bumped up by one.
359 When it is on, the pregap track for each disc can be numbered zero.
360
361 .. _config-aunique:
362
363 aunique
364 ~~~~~~~
365
366 These options are used to generate a string that is guaranteed to be unique
367 among all albums in the library who share the same set of keys.
368
369 The defaults look like this:
370
371 ::
372
373 aunique:
374 keys: albumartist album
375 disambiguators: albumtype year label catalognum albumdisambig releasegroupdisambig
376 bracket: '[]'
377
378 See :ref:`aunique` for more details.
379
380 .. _config-sunique:
381
382 sunique
383 ~~~~~~~
384
385 Like :ref:`config-aunique` above for albums, these options control the
386 generation of a unique string to disambiguate *singletons* that share similar
387 metadata.
388
389 The defaults look like this:
390
391 ::
392
393 sunique:
394 keys: artist title
395 disambiguators: year trackdisambig
396 bracket: '[]'
397
398 See :ref:`sunique` for more details.
399
400 .. _terminal_encoding:
401
402 terminal_encoding
403 ~~~~~~~~~~~~~~~~~
404
405 The text encoding, as `known to Python
406 <https://docs.python.org/3/library/codecs.html#standard-encodings>`__, to use
407 for messages printed to the standard output. It's also used to read messages
408 from the standard input. By default, this is determined automatically from the
409 locale environment variables.
410
411 .. _clutter:
412
413 clutter
414 ~~~~~~~
415
416 When beets imports all the files in a directory, it tries to remove the
417 directory if it's empty. A directory is considered empty if it only contains
418 files whose names match the glob patterns in ``clutter``, which should be a list
419 of strings. The default list consists of "Thumbs.DB" and ".DS_Store".
420
421 The importer only removes recursively searched subdirectories---the top-level
422 directory you specify on the command line is never deleted.
423
424 .. _max_filename_length:
425
426 max_filename_length
427 ~~~~~~~~~~~~~~~~~~~
428
429 Set the maximum number of characters in a filename, after which names will be
430 truncated. By default, beets tries to ask the filesystem for the correct
431 maximum.
432
433 .. _id3v23:
434
435 id3v23
436 ~~~~~~
437
438 By default, beets writes MP3 tags using the ID3v2.4 standard, the latest version
439 of ID3. Enable this option to instead use the older ID3v2.3 standard, which is
440 preferred by certain older software such as Windows Media Player.
441
442 .. _va_name:
443
444 va_name
445 ~~~~~~~
446
447 Sets the albumartist for various-artist compilations. Defaults to ``'Various
448 Artists'`` (the MusicBrainz standard). Affects other sources, such as
449 :doc:`/plugins/discogs`, too.
450
451 .. _ui_options:
452
453 UI Options
454 ----------
455
456 The options that allow for customization of the visual appearance of the console
457 interface.
458
459 color
460 ~~~~~
461
462 Either ``yes`` or ``no``; whether to use color in console output. Turn this off
463 if your terminal doesn't support ANSI colors.
464
465 .. _colors:
466
467 colors
468 ~~~~~~
469
470 The colors that are used throughout the user interface. These are only used if
471 the ``color`` option is set to ``yes``. See the default configuration:
472
473 .. code-block:: yaml
474
475 ui:
476 colors:
477 text_success: ['bold', 'green']
478 text_warning: ['bold', 'yellow']
479 text_error: ['bold', 'red']
480 text_highlight: ['bold', 'red']
481 text_highlight_minor: ['white']
482 action_default: ['bold', 'cyan']
483 action: ['bold', 'cyan']
484 # New colors after UI overhaul
485 text_faint: ['faint']
486 import_path: ['bold', 'blue']
487 import_path_items: ['bold', 'blue']
488 changed: ['yellow']
489 text_diff_added: ['bold', 'green']
490 text_diff_removed: ['bold', 'red']
491 action_description: ['white']
492
493 Available attributes:
494
495 Foreground colors
496 ``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``cyan``,
497 ``white``, ``bright_black``, ``bright_red``, ``bright_green``,
498 ``bright_yellow``, ``bright_blue``, ``bright_magenta``, ``bright_cyan``,
499 ``bright_white``
500
501 Background colors
502 ``bg_black``, ``bg_red``, ``bg_green``, ``bg_yellow``, ``bg_blue``,
503 ``bg_magenta``, ``bg_cyan``, ``bg_white``, ``bg_bright_black``,
504 ``bg_bright_red``, ``bg_bright_green``, ``bg_bright_yellow``,
505 ``bg_bright_blue``, ``bg_bright_magenta``, ``bg_bright_cyan``,
506 ``bg_bright_white``
507
508 Text styles
509 ``normal``, ``bold``, ``faint``, ``italic``, ``underline``, ``blink_slow``,
510 ``blink_rapid``, ``inverse``, ``conceal``, ``crossed_out``
511
512 terminal_width
513 ~~~~~~~~~~~~~~
514
515 Controls line wrapping on non-Unix systems. On Unix systems, the width of the
516 terminal is detected automatically. If this fails, or on non-Unix systems, the
517 specified value is used as a fallback. Defaults to ``80`` characters:
518
519 .. code-block:: yaml
520
521 ui:
522 terminal_width: 80
523
524 length_diff_thresh
525 ~~~~~~~~~~~~~~~~~~
526
527 Beets compares the length of the imported track with the length the metadata
528 source provides. If any tracks differ by at least ``length_diff_thresh``
529 seconds, they will be colored with ``text_highlight``. Below this threshold,
530 different track lengths are colored with ``text_highlight_minor``.
531 ``length_diff_thresh`` does not impact which releases are selected in autotagger
532 matching or distance score calculation (see :ref:`match-config`,
533 ``distance_weights`` and :ref:`colors`):
534
535 .. code-block:: yaml
536
537 ui:
538 length_diff_thresh: 10.0
539
540 import
541 ~~~~~~
542
543 When importing, beets will read several options to configure the visuals of the
544 import dialogue. There are two layouts controlling how horizontal space and line
545 wrapping is dealt with: ``column`` and ``newline``. The indentation of the
546 respective elements of the import UI can also be configured. For example setting
547 ``2`` for ``match_header`` will indent the very first block of a proposed match
548 by two characters in the terminal:
549
550 .. code-block:: yaml
551
552 ui:
553 import:
554 indentation:
555 match_header: 2
556 match_details: 2
557 match_tracklist: 5
558 layout: column
559
560 Importer Options
561 ----------------
562
563 The options that control the :ref:`import-cmd` command are indented under the
564 ``import:`` key. For example, you might have a section in your configuration
565 file that looks like this:
566
567 ::
568
569 import:
570 write: yes
571 copy: yes
572 resume: no
573
574 These options are available in this section:
575
576 .. _config-import-write:
577
578 write
579 ~~~~~
580
581 Either ``yes`` or ``no``, controlling whether metadata (e.g., ID3) tags are
582 written to files when using ``beet import``. Defaults to ``yes``. The ``-w`` and
583 ``-W`` command-line options override this setting.
584
585 .. _config-import-copy:
586
587 copy
588 ~~~~
589
590 Either ``yes`` or ``no``, indicating whether to **copy** files into the library
591 directory when using ``beet import``. Defaults to ``yes``. Can be overridden
592 with the ``-c`` and ``-C`` command-line options.
593
594 The option is ignored if ``move`` is enabled (i.e., beets can move or copy files
595 but it doesn't make sense to do both).
596
597 .. _config-import-move:
598
599 move
600 ~~~~
601
602 Either ``yes`` or ``no``, indicating whether to **move** files into the library
603 directory when using ``beet import``. Defaults to ``no``.
604
605 The effect is similar to the ``copy`` option but you end up with only one copy
606 of the imported file. ("Moving" works even across filesystems; if necessary,
607 beets will copy and then delete when a simple rename is impossible.) Moving
608 files can be risky—it's a good idea to keep a backup in case beets doesn't do
609 what you expect with your files.
610
611 In the case of a ``move`` when importing an archive, the archive will be removed
612 if all contents were successfully imported.
613
614 This option *overrides* ``copy``, so enabling it will always move (and not copy)
615 files. The ``-c`` switch to the ``beet import`` command, however, still takes
616 precedence.
617
618 .. _link:
619
620 link
621 ~~~~
622
623 Either ``yes`` or ``no``, indicating whether to use symbolic links instead of
624 moving or copying files. (It conflicts with the ``move``, ``copy`` and
625 ``hardlink`` options.) Defaults to ``no``.
626
627 This option only works on platforms that support symbolic links: i.e., Unixes.
628 It will fail on Windows.
629
630 It's likely that you'll also want to set ``write`` to ``no`` if you use this
631 option to preserve the metadata on the linked files.
632
633 .. _hardlink:
634
635 hardlink
636 ~~~~~~~~
637
638 Either ``yes`` or ``no``, indicating whether to use hard links instead of
639 moving, copying, or symlinking files. (It conflicts with the ``move``, ``copy``,
640 and ``link`` options.) Defaults to ``no``.
641
642 As with symbolic links (see :ref:`link`, above), this will not work on Windows
643 and you will want to set ``write`` to ``no``. Otherwise, metadata on the
644 original file will be modified.
645
646 .. _reflink:
647
648 reflink
649 ~~~~~~~
650
651 Either ``yes``, ``no``, or ``auto``, indicating whether to use copy-on-write
652 `file clones`_ (a.k.a. "reflinks") instead of copying or moving files. The
653 ``auto`` option uses reflinks when possible and falls back to plain copying when
654 necessary. Defaults to ``no``.
655
656 This kind of clone is only available on certain filesystems: for example, btrfs
657 and APFS. For more details on filesystem support, see the pyreflink_
658 documentation. Note that you need to install ``pyreflink``, either through
659 ``python -m pip install beets[reflink]`` or ``python -m pip install reflink``.
660
661 The option is ignored if ``move`` is enabled (i.e., beets can move or copy files
662 but it doesn't make sense to do both).
663
664 .. _file clones: https://en.wikipedia.org/wiki/Copy-on-write
665
666 .. _pyreflink: https://reflink.readthedocs.io/en/latest/
667
668 resume
669 ~~~~~~
670
671 Either ``yes``, ``no``, or ``ask``. Controls whether interrupted imports should
672 be resumed. "Yes" means that imports are always resumed when possible; "no"
673 means resuming is disabled entirely; "ask" (the default) means that the user
674 should be prompted when resuming is possible. The ``-p`` and ``-P`` flags
675 correspond to the "yes" and "no" settings and override this option.
676
677 .. _incremental:
678
679 incremental
680 ~~~~~~~~~~~
681
682 Either ``yes`` or ``no``, controlling whether imported directories are recorded
683 and whether these recorded directories are skipped. This corresponds to the
684 ``-i`` flag to ``beet import``.
685
686 .. _incremental_skip_later:
687
688 incremental_skip_later
689 ~~~~~~~~~~~~~~~~~~~~~~
690
691 Either ``yes`` or ``no``, controlling whether skipped directories are recorded
692 in the incremental list. When set to ``yes``, skipped directories won't be
693 recorded, and beets will try to import them again later. When set to ``no``,
694 skipped directories will be recorded, and skipped later. Defaults to ``no``.
695
696 .. _from_scratch:
697
698 from_scratch
699 ~~~~~~~~~~~~
700
701 Either ``yes`` or ``no`` (default), controlling whether existing metadata is
702 discarded when a match is applied. This corresponds to the ``--from-scratch``
703 flag to ``beet import``.
704
705 .. _quiet:
706
707 quiet
708 ~~~~~
709
710 Either ``yes`` or ``no`` (default), controlling whether to ask for a manual
711 decision from the user when the importer is unsure how to proceed. This
712 corresponds to the ``--quiet`` flag to ``beet import``.
713
714 .. _quiet_fallback:
715
716 quiet_fallback
717 ~~~~~~~~~~~~~~
718
719 Either ``skip`` (default) or ``asis``, specifying what should happen in quiet
720 mode (see the ``-q`` flag to ``import``, above) when there is no strong
721 recommendation.
722
723 .. _none_rec_action:
724
725 none_rec_action
726 ~~~~~~~~~~~~~~~
727
728 Either ``ask`` (default), ``asis`` or ``skip``. Specifies what should happen
729 during an interactive import session when there is no recommendation. Useful
730 when you are only interested in processing medium and strong recommendations
731 interactively.
732
733 timid
734 ~~~~~
735
736 Either ``yes`` or ``no``, controlling whether the importer runs in *timid* mode,
737 in which it asks for confirmation on every autotagging match, even the ones that
738 seem very close. Defaults to ``no``. The ``-t`` command-line flag controls the
739 same setting.
740
741 .. _import_log:
742
743 log
744 ~~~
745
746 Specifies a filename where the importer's log should be kept. By default, no log
747 is written. This can be overridden with the ``-l`` flag to ``import``.
748
749 .. _default_action:
750
751 default_action
752 ~~~~~~~~~~~~~~
753
754 One of ``apply``, ``skip``, ``asis``, or ``none``, indicating which option
755 should be the *default* when selecting an action for a given match. This is the
756 action that will be taken when you type return without an option letter. The
757 default is ``apply``.
758
759 .. _languages:
760
761 languages
762 ~~~~~~~~~
763
764 A list of locale names to search for preferred aliases. For example, setting
765 this to ``en`` uses the transliterated artist name "Pyotr Ilyich Tchaikovsky"
766 instead of the Cyrillic script for the composer's name when tagging from
767 MusicBrainz. You can use a space-separated list of language abbreviations, like
768 ``en jp es``, to specify a preference order. Defaults to an empty list, meaning
769 that no language is preferred.
770
771 The alias is used for artist name, track title, release group title and album
772 title.
773
774 .. _ignored_alias_types:
775
776 ignored_alias_types
777 ~~~~~~~~~~~~~~~~~~~
778
779 A list of alias types to be ignored when importing new items.
780
781 See the ``MusicBrainz Documentation`` for more information on aliases.
782
783 .._MusicBrainz Documentation: https://musicbrainz.org/doc/Aliases
784
785 .. _detail:
786
787 detail
788 ~~~~~~
789
790 Whether the importer UI should show detailed information about each match it
791 finds. When enabled, this mode prints out the title of every track, regardless
792 of whether it matches the original metadata. (The default behavior only shows
793 changes.) Default: ``no``.
794
795 .. _group_albums:
796
797 group_albums
798 ~~~~~~~~~~~~
799
800 By default, the beets importer groups tracks into albums based on the
801 directories they reside in. This option instead uses files' metadata to
802 partition albums. Enable this option if you have directories that contain tracks
803 from many albums mixed together.
804
805 The ``--group-albums`` or ``-g`` option to the :ref:`import-cmd` command is
806 equivalent, and the *G* interactive option invokes the same workflow.
807
808 Default: ``no``.
809
810 .. _autotag:
811
812 autotag
813 ~~~~~~~
814
815 By default, the beets importer always attempts to autotag new music. If most of
816 your collection consists of obscure music, you may be interested in disabling
817 autotagging by setting this option to ``no``. (You can re-enable it with the
818 ``-a`` flag to the :ref:`import-cmd` command.)
819
820 Default: ``yes``.
821
822 .. _duplicate_keys:
823
824 duplicate_keys
825 ~~~~~~~~~~~~~~
826
827 The fields used to find duplicates when importing. There are two sub-values
828 here: ``album`` and ``item``. Each one is a list of field names; if an existing
829 object (album or item) in the library matches the new object on all of these
830 fields, the importer will consider it a duplicate.
831
832 Default:
833
834 ::
835
836 album: albumartist album
837 item: artist title
838
839 For MusicBrainz-tagged libraries, adding ``mb_albumid`` to the album keys
840 distinguishes separate releases that have the same album artist and title:
841
842 .. code-block:: yaml
843
844 album: albumartist album mb_albumid
845 item: artist title
846
847 All configured fields must match. Albums with different MusicBrainz release IDs
848 will therefore not be considered duplicates. An album without a MusicBrainz
849 release ID will also not match an otherwise identical album that has one.
850
851 .. _duplicate_action:
852
853 duplicate_action
854 ~~~~~~~~~~~~~~~~
855
856 Either ``skip``, ``keep``, ``remove``, ``merge``, ``upgrade`` or ``ask``.
857 Controls how duplicates are treated in import task. "skip" means that new
858 item(album or track) will be skipped; "keep" means keep both old and new items;
859 "remove" means remove old item; "merge" means merge into one album; "ask" means
860 the user should be prompted for the action each time. The default is ``ask``.
861
862 "upgrade" compares each newly-imported track against any existing duplicate with
863 the same :ref:`duplicate_keys`: a track only replaces its old counterpart if it
864 has a higher bitrate, and tracks with no old counterpart are always added. The
865 rest of the existing album is left untouched, and the kept tracks are added to
866 that same album rather than a new one. If the import matches more than one
867 existing album (e.g. two differently-encoded copies of the same release already
868 in the library), only the album it overlaps with the most is upgraded; every
869 other candidate album is left completely untouched, since a track can only ever
870 be added to one album. When ``duplicate_action`` is ``ask``, "upgrade" is one of
871 the available interactive choices.
872
873 .. _duplicate_verbose_prompt:
874
875 duplicate_verbose_prompt
876 ~~~~~~~~~~~~~~~~~~~~~~~~
877
878 Usually when duplicates are detected during import, information about the
879 existing and the newly imported album is summarized. Enabling this option also
880 lists details on individual tracks. The :ref:`format_item setting <format_item>`
881 is applied, which would, considering the default, look like this:
882
883 .. code-block:: console
884
885 This item is already in the library!
886 Old: 1 items, MP3, 320kbps, 5:56, 13.6 MiB
887 Artist Name - Album Name - Third Track Title
888 New: 2 items, MP3, 320kbps, 7:18, 17.1 MiB
889 Artist Name - Album Name - First Track Title
890 Artist Name - Album Name - Second Track Title
891 [S]kip new, Merge all, Remove old, Keep all, Upgrade?
892
893 Default: ``no``.
894
895 .. _bell:
896
897 bell
898 ~~~~
899
900 Ring the terminal bell to get your attention when the importer needs your input.
901
902 Default: ``no``.
903
904 .. _set_fields:
905
906 set_fields
907 ~~~~~~~~~~
908
909 A dictionary indicating fields to set to values for newly imported music. Here's
910 an example:
911
912 .. code-block:: yaml
913
914 set_fields:
915 genres: To Listen
916 collection: Unordered
917
918 Other field/value pairs supplied via the ``--set`` option on the command-line
919 override any settings here for fields with the same name.
920
921 Values support the same template syntax as beets' :doc:`path formats
922 <pathformat>`.
923
924 Fields are set on both the album and each individual track of the album. Fields
925 are persisted to the media files of each track.
926
927 Default: ``{}`` (empty).
928
929 .. _singleton_album_disambig:
930
931 singleton_album_disambig
932 ~~~~~~~~~~~~~~~~~~~~~~~~
933
934 During singleton imports and if the metadata source provides it, album names are
935 appended to the disambiguation string of matching track candidates. For example:
936 ``The Artist - The Title (Discogs, Index 3, Track B1, [The Album]``. This
937 feature is currently supported by the :doc:`/plugins/discogs` and the
938 :doc:`/plugins/spotify`.
939
940 Default: ``yes``.
941
942 .. _fix_ext_inplace:
943
944 fix_ext_inplace
945 ~~~~~~~~~~~~~~~
946
947 The extension of each file is checked at import. If a file has no extension and
948 its binary matches a music format, beets will look for a file with the same name
949 and matching extension in the same directory. For example, when importing an mp3
950 file named ``asdf``, beets look for ``asdf.mp3``. If found, that file will be
951 imported instead. Otherwise, if ``fix_ext_inplace`` is ``yes``, then the file
952 will be renamed to contain the extension. If ``fix_ext_inplace`` is ``no``, then
953 the original will be left untouched and a copy with extension will be created in
954 the same directory. This is only done if the user has ``ffprobe`` (bundled with
955 FFmpeg)
956
957 Default: ``no``.
958
959 .. _remux_mp3_in_wav:
960
961 remux_mp3_in_wav
962 ~~~~~~~~~~~~~~~~
963
964 Some WAV files contain MP3 audio streams (``WAVE_FORMAT_MPEGLAYER3``) rather
965 than the standard PCM format. When this option is enabled, beets will
966 automatically extract the MP3 stream into a proper ``.mp3`` file during import,
967 removing the WAV container. The original WAV file is deleted after successful
968 extraction.
969
970 Default: ``yes``.
971
972 .. _match-config:
973
974 Autotagger Matching Options
975 ---------------------------
976
977 You can configure some aspects of the logic beets uses when automatically
978 matching MusicBrainz results under the ``match:`` section. To control how
979 *tolerant* the autotagger is of differences, use the ``strong_rec_thresh``
980 option, which reflects the distance threshold below which beets will make a
981 "strong recommendation" that the metadata be used. Strong recommendations are
982 accepted automatically (except in "timid" mode), so you can use this to make
983 beets ask your opinion more or less often.
984
985 The threshold is a *distance* value between 0.0 and 1.0, so you can think of it
986 as the opposite of a *similarity* value. For example, if you want to
987 automatically accept any matches above 90% similarity, use:
988
989 ::
990
991 match:
992 strong_rec_thresh: 0.10
993
994 The default strong recommendation threshold is 0.04.
995
996 The ``medium_rec_thresh`` and ``rec_gap_thresh`` options work similarly. When a
997 match is below the *medium* recommendation threshold or the distance between it
998 and the next-best match is above the *gap* threshold, the importer will suggest
999 that match but not automatically confirm it. Otherwise, you'll see a list of
1000 options to choose from.
1001
1002 .. _distance-weights:
1003
1004 distance_weights
1005 ~~~~~~~~~~~~~~~~
1006
1007 The ``distance_weights`` option allows you to customize how much each field
1008 contributes to the overall distance score when matching albums and tracks.
1009 Higher weights mean that differences in that field are penalized more heavily,
1010 making them more important in the matching decision.
1011
1012 The defaults are:
1013
1014 .. code-block:: yaml
1015
1016 match:
1017 distance_weights:
1018 data_source: 2.0
1019 artist: 3.0
1020 album: 3.0
1021 media: 1.0
1022 mediums: 1.0
1023 year: 1.0
1024 country: 0.5
1025 label: 0.5
1026 catalognum: 0.5
1027 albumdisambig: 0.5
1028 album_id: 5.0
1029 tracks: 2.0
1030 missing_tracks: 0.9
1031 unmatched_tracks: 0.6
1032 track_title: 3.0
1033 track_artist: 2.0
1034 track_index: 1.0
1035 track_length: 2.0
1036 track_id: 5.0
1037 medium: 1.0
1038
1039 For example, if you don't care as much about matching the exact release year,
1040 you can reduce its weight:
1041
1042 .. code-block:: yaml
1043
1044 match:
1045 distance_weights:
1046 year: 0.1
1047
1048 You only need to specify the fields you want to override; unspecified fields
1049 keep their default weights.
1050
1051 .. _max_rec:
1052
1053 max_rec
1054 ~~~~~~~
1055
1056 As mentioned above, autotagger matches have *recommendations* that control how
1057 the UI behaves for a certain quality of match. The recommendation for a certain
1058 match is based on the overall distance calculation. But you can also control the
1059 recommendation when a specific distance penalty is applied by defining *maximum*
1060 recommendations for each field:
1061
1062 To define maxima, use keys under ``max_rec:`` in the ``match`` section. The
1063 defaults are "medium" for missing and unmatched tracks and "strong" (i.e., no
1064 maximum) for everything else:
1065
1066 ::
1067
1068 match:
1069 max_rec:
1070 missing_tracks: medium
1071 unmatched_tracks: medium
1072
1073 If a recommendation is higher than the configured maximum and the indicated
1074 penalty is applied, the recommendation is downgraded. The setting for each field
1075 can be one of ``none``, ``low``, ``medium`` or ``strong``. When the maximum
1076 recommendation is ``strong``, no "downgrading" occurs. The available penalty
1077 names here are:
1078
1079 - data_source
1080 - artist
1081 - album
1082 - media
1083 - mediums
1084 - year
1085 - country
1086 - label
1087 - catalognum
1088 - albumdisambig
1089 - album_id
1090 - tracks
1091 - missing_tracks
1092 - unmatched_tracks
1093 - track_title
1094 - track_artist
1095 - track_index
1096 - track_length
1097 - track_id
1098
1099 .. _preferred:
1100
1101 preferred
1102 ~~~~~~~~~
1103
1104 In addition to comparing the tagged metadata with the match metadata for
1105 similarity, you can also specify an ordered list of preferred countries and
1106 media types.
1107
1108 A distance penalty will be applied if the country or media type from the match
1109 metadata doesn't match. The specified values are preferred in descending order
1110 (i.e., the first item will be most preferred). Each item may be a regular
1111 expression, and will be matched case insensitively. The number of media will be
1112 stripped when matching preferred media (e.g. "2x" in "2xCD").
1113
1114 You can also tell the autotagger to prefer matches that have a release year
1115 closest to the original year for an album.
1116
1117 Here's an example:
1118
1119 ::
1120
1121 match:
1122 preferred:
1123 countries: ['US', 'GB|UK']
1124 media: ['CD', 'Digital Media|File']
1125 original_year: yes
1126
1127 By default, none of these options are enabled.
1128
1129 .. _ignored:
1130
1131 ignored
1132 ~~~~~~~
1133
1134 You can completely avoid matches that have certain penalties applied by adding
1135 the penalty name to the ``ignored`` setting:
1136
1137 ::
1138
1139 match:
1140 ignored: missing_tracks unmatched_tracks
1141
1142 The available penalties are the same as those for the :ref:`max_rec` setting.
1143
1144 For example, setting ``ignored: missing_tracks`` will skip any album matches
1145 where your audio files are missing some of the tracks. The importer will not
1146 attempt to display these matches. It does not ignore the fact that the album is
1147 missing tracks, which would allow these matches to apply more easily. To do
1148 that, you'll want to adjust the penalty for missing tracks.
1149
1150 .. _required:
1151
1152 required
1153 ~~~~~~~~
1154
1155 You can avoid matches that lack certain required information. Add the tags you
1156 want to enforce to the ``required`` setting:
1157
1158 ::
1159
1160 match:
1161 required: year label catalognum country
1162
1163 No tags are required by default.
1164
1165 .. _ignored_media:
1166
1167 ignored_media
1168 ~~~~~~~~~~~~~
1169
1170 A list of media (i.e., formats) in metadata databases to ignore when matching
1171 music. You can use this to ignore all media that usually contain video instead
1172 of audio, for example:
1173
1174 ::
1175
1176 match:
1177 ignored_media: ['Data CD', 'DVD', 'DVD-Video', 'Blu-ray', 'HD-DVD',
1178 'VCD', 'SVCD', 'UMD', 'VHS']
1179
1180 No formats are ignored by default.
1181
1182 .. _ignore_data_tracks:
1183
1184 ignore_data_tracks
1185 ~~~~~~~~~~~~~~~~~~
1186
1187 By default, audio files contained in data tracks within a release are included
1188 in the album's tracklist. If you want them to be included, set it ``no``.
1189
1190 Default: ``yes``.
1191
1192 .. _ignore_video_tracks:
1193
1194 ignore_video_tracks
1195 ~~~~~~~~~~~~~~~~~~~
1196
1197 By default, video tracks within a release will be ignored. If you want them to
1198 be included (for example if you would like to track the audio-only versions of
1199 the video tracks), set it to ``no``.
1200
1201 Default: ``yes``.
1202
1203 .. _path-format-config:
1204
1205 Path Format Configuration
1206 -------------------------
1207
1208 You can also configure the directory hierarchy beets uses to store music. These
1209 settings appear under the ``paths:`` key. Each string is a template string that
1210 can refer to metadata fields like ``$artist`` or ``$title``. The filename
1211 extension is added automatically. At the moment, you can specify three special
1212 paths: ``default`` for most releases, ``comp`` for "various artist" releases
1213 with no dominant artist, and ``singleton`` for non-album tracks. The defaults
1214 look like this:
1215
1216 ::
1217
1218 paths:
1219 default: $albumartist/$album%aunique{}/$track $title
1220 singleton: Non-Album/$artist/$title
1221 comp: Compilations/$album%aunique{}/$track $title
1222
1223 Note the use of ``$albumartist`` instead of ``$artist``; this ensures that
1224 albums will be well-organized. For more about these format strings, see
1225 :doc:`pathformat`. The ``aunique{}`` function ensures that identically-named
1226 albums are placed in different directories; see :ref:`aunique` for details.
1227
1228 In addition to ``default``, ``comp``, and ``singleton``, you can condition path
1229 queries based on beets queries (see :doc:`/reference/query`). This means that a
1230 config file like this:
1231
1232 ::
1233
1234 paths:
1235 albumtype:soundtrack: Soundtracks/$album/$track $title
1236
1237 will place soundtrack albums in a separate directory. The queries are tested in
1238 the order they appear in the configuration file, meaning that if an item matches
1239 multiple queries, beets will use the path format for the *first* matching query.
1240 Queries on multi-value fields, such as ``genres``, match each individual value,
1241 so an exact string query like ``genres:=Classical`` can match an item whose
1242 genres are ``Classical`` and ``Baroque`` without also matching ``Neoclassical``.
1243
1244 Note that the special ``singleton`` and ``comp`` path format conditions are, in
1245 fact, just shorthand for the explicit queries ``singleton:true`` and
1246 ``comp:true``. In contrast, ``default`` is special and has no query equivalent:
1247 the ``default`` format is only used if no queries match.
1248
1249 Configuration Location
1250 ----------------------
1251
1252 The beets configuration file is usually located in a standard location that
1253 depends on your OS, but there are a couple of ways you can tell beets where to
1254 look.
1255
1256 Environment Variable
1257 ~~~~~~~~~~~~~~~~~~~~
1258
1259 First, you can set the ``BEETSDIR`` environment variable to a directory
1260 containing a ``config.yaml`` file. This replaces your configuration in the
1261 default location. This also affects where auxiliary files, like the library
1262 database, are stored by default (that's where relative paths are resolved to).
1263 This environment variable is useful if you need to manage multiple beets
1264 libraries with separate configurations.
1265
1266 Command-Line Option
1267 ~~~~~~~~~~~~~~~~~~~
1268
1269 Alternatively, you can use the ``--config`` command-line option to indicate a
1270 YAML file containing options that will then be merged with your existing options
1271 (from ``BEETSDIR`` or the default locations). This is useful if you want to keep
1272 your configuration mostly the same but modify a few options as a batch. For
1273 example, you might have different strategies for importing files, each with a
1274 different set of importer options.
1275
1276 Default Location
1277 ~~~~~~~~~~~~~~~~
1278
1279 In the absence of a ``BEETSDIR`` variable, beets searches a few places for your
1280 configuration, depending on the platform:
1281
1282 - On Unix platforms, including OS X:``~/.config/beets`` and then
1283 ``$XDG_CONFIG_DIR/beets``, if the environment variable is set.
1284 - On OS X, we also search ``~/Library/Application Support/beets`` before the
1285 Unixy locations.
1286 - On Windows: ``~\AppData\Roaming\beets``, and then ``%APPDATA%\beets``, if the
1287 environment variable is set.
1288
1289 Beets uses the first directory in your platform's list that contains
1290 ``config.yaml``. If no config file exists, the last path in the list is used.
1291
1292 .. _config-example:
1293
1294 Example
1295 -------
1296
1297 Here's an example file:
1298
1299 ::
1300
1301 directory: /var/mp3
1302 import:
1303 copy: yes
1304 write: yes
1305 log: beetslog.txt
1306 art_filename: albumart
1307 plugins: bpd
1308 pluginpath: ~/beets/myplugins
1309 ui:
1310 color: yes
1311
1312 paths:
1313 default: %first{$genres}/$albumartist/$album/$track $title
1314 singleton: Singletons/$artist - $title
1315 comp: %first{$genres}/$album/$track $title
1316 albumtype:soundtrack: Soundtracks/$album/$track $title
1317
1318 .. only:: man
1319
1320 See Also
1321 --------
1322
1323 ``https://beets.readthedocs.org/``
1324
1325 :manpage:`beet(1)`