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