| 1 |
Command-Line Interface |
| 2 |
====================== |
| 3 |
|
| 4 |
.. only:: man |
| 5 |
|
| 6 |
SYNOPSIS |
| 7 |
-------- |
| 8 |
|
| 9 |
| **beet** [*args*...] *command* [*args*...] |
| 10 |
| **beet help** *command* |
| 11 |
|
| 12 |
.. only:: html |
| 13 |
|
| 14 |
**beet** is the command-line interface to beets. |
| 15 |
|
| 16 |
You invoke beets by specifying a *command*, like so:: |
| 17 |
|
| 18 |
beet COMMAND [ARGS...] |
| 19 |
|
| 20 |
The rest of this document describes the available |
| 21 |
commands. If you ever need a quick list of what's available, just |
| 22 |
type ``beet help`` or ``beet help COMMAND`` for help with a specific |
| 23 |
command. |
| 24 |
|
| 25 |
Beets also offers shell completion. For bash, see the `completion`_ |
| 26 |
command; for zsh, see the accompanying `completion script`_ for the |
| 27 |
``beet`` command. |
| 28 |
|
| 29 |
Commands |
| 30 |
-------- |
| 31 |
|
| 32 |
.. only:: html |
| 33 |
|
| 34 |
Here are the built-in commands available in beets: |
| 35 |
|
| 36 |
.. contents:: |
| 37 |
:local: |
| 38 |
:depth: 1 |
| 39 |
|
| 40 |
Also be sure to see the :ref:`global flags <global-flags>`. |
| 41 |
|
| 42 |
.. _import-cmd: |
| 43 |
|
| 44 |
import |
| 45 |
~~~~~~ |
| 46 |
|
| 47 |
:: |
| 48 |
|
| 49 |
beet import [-CMWAPRqst] [-l LOGPATH] PATH... |
| 50 |
beet import [options] -L QUERY |
| 51 |
|
| 52 |
Add music to your library, attempting to get correct tags for it from |
| 53 |
MusicBrainz. |
| 54 |
|
| 55 |
Point the command at some music: directories, single files, or compressed |
| 56 |
archives. The music will be copied to a configurable directory structure and |
| 57 |
added to a library database. The command is interactive and will try to get you |
| 58 |
to verify MusicBrainz tags that it thinks are suspect. See the :doc:`autotagging |
| 59 |
guide </guides/tagger>` for detail on how to use the interactive tag-correction |
| 60 |
flow. |
| 61 |
|
| 62 |
Directories passed to the import command can contain either a single album or |
| 63 |
many, in which case the leaf directories will be considered albums (the latter |
| 64 |
case is true of typical Artist/Album organizations and many people's "downloads" |
| 65 |
folders). The path can also be a single song or an archive. Beets supports |
| 66 |
``zip`` and ``tar`` archives out of the box. To extract ``rar`` files, install |
| 67 |
the rarfile_ package and the ``unrar`` command. To extract ``7z`` files, install |
| 68 |
the py7zr_ package. |
| 69 |
|
| 70 |
Optional command flags: |
| 71 |
|
| 72 |
- By default, the command copies files to your library directory and updates the |
| 73 |
ID3 tags on your music. In order to move the files, instead of copying, use |
| 74 |
the ``-m`` (move) option. When importing an archive with ``-m``, if all files |
| 75 |
are imported, the archive is removed from disk. If you'd like to leave your |
| 76 |
music files untouched, try the ``-C`` (don't copy), ``-M`` (don't move), and |
| 77 |
``-W`` (don't write tags) options. You can also disable this behavior by |
| 78 |
default in the configuration file (below). |
| 79 |
- Also, you can disable the autotagging behavior entirely using ``-A`` (don't |
| 80 |
autotag)---then your music will be imported with its existing metadata. |
| 81 |
- During a long tagging import, it can be useful to keep track of albums that |
| 82 |
weren't tagged successfully---either because they're not in the MusicBrainz |
| 83 |
database or because something's wrong with the files. Use the ``-l`` option to |
| 84 |
specify a filename to log every time you skip an album or import it "as-is" or |
| 85 |
an album gets skipped as a duplicate. You can later review the file manually |
| 86 |
or import skipped paths from the logfile automatically by using the |
| 87 |
``--from-logfile LOGFILE`` argument. |
| 88 |
- Relatedly, the ``-q`` (quiet) option can help with large imports by |
| 89 |
autotagging without ever bothering to ask for user input. Whenever the normal |
| 90 |
autotagger mode would ask for confirmation, the quiet mode performs a fallback |
| 91 |
action that can be configured using the ``quiet_fallback`` configuration or |
| 92 |
``--quiet-fallback`` CLI option. By default it pessimistically skips the file. |
| 93 |
Alternatively, it can be used as is, by configuring ``asis``. |
| 94 |
- Speaking of resuming interrupted imports, the tagger will prompt you if it |
| 95 |
seems like the last import of the directory was interrupted (by you or by a |
| 96 |
crash). If you want to skip this prompt, you can say "yes" automatically by |
| 97 |
providing ``-p`` or "no" using ``-P``. The resuming feature can be disabled by |
| 98 |
default using a configuration option (see below). |
| 99 |
- If you want to import only the *new* stuff from a directory, use the ``-i`` |
| 100 |
option to run an *incremental* import. With this flag, beets will keep track |
| 101 |
of every directory it ever imports and avoid importing them again. This is |
| 102 |
useful if you have an "incoming" directory that you periodically add things |
| 103 |
to. To get this to work correctly, you'll need to use an incremental import |
| 104 |
*every time* you run an import on the directory in question---including the |
| 105 |
first time, when no subdirectories will be skipped. So consider enabling the |
| 106 |
``incremental`` configuration option. |
| 107 |
- If you don't want to record skipped files during an *incremental* import, use |
| 108 |
the ``--incremental-skip-later`` flag which corresponds to the |
| 109 |
``incremental_skip_later`` configuration option. Setting the flag prevents |
| 110 |
beets from persisting skip decisions during a non-interactive import so that a |
| 111 |
user can make a decision regarding previously skipped files during a |
| 112 |
subsequent interactive import run. To record skipped files during incremental |
| 113 |
import explicitly, use the ``--noincremental-skip-later`` option. |
| 114 |
- When beets applies metadata to your music, it will retain the value of any |
| 115 |
existing tags that weren't overwritten, and import them into the database. You |
| 116 |
may prefer to only use existing metadata for finding matches, and to erase it |
| 117 |
completely when new metadata is applied. You can enforce this behavior with |
| 118 |
the ``--from-scratch`` option, or the ``from_scratch`` configuration option. |
| 119 |
- By default, beets will proceed without asking if it finds a very close |
| 120 |
metadata match. To disable this and have the importer ask you every time, use |
| 121 |
the ``-t`` (for *timid*) option. |
| 122 |
- The importer typically works in a whole-album-at-a-time mode. If you instead |
| 123 |
want to import individual, non-album tracks, use the *singleton* mode by |
| 124 |
supplying the ``-s`` option. |
| 125 |
- If you have an album that's split across several directories under a common |
| 126 |
top directory, use the ``--flat`` option. This takes all the music files under |
| 127 |
the directory (recursively) and treats them as a single large album instead of |
| 128 |
as one album per directory. This can help with your more stubborn multi-disc |
| 129 |
albums. |
| 130 |
- Similarly, if you have one directory that contains multiple albums, use the |
| 131 |
``--group-albums`` option to split the files based on their metadata before |
| 132 |
matching them as separate albums. |
| 133 |
- If you want to preview which files would be imported, use the ``--pretend`` |
| 134 |
option. If set, beets will just print a list of files that it would otherwise |
| 135 |
import. |
| 136 |
- If you already have a metadata backend ID that matches the items to be |
| 137 |
imported, you can instruct beets to restrict the search to that ID instead of |
| 138 |
searching for other candidates by using the ``--search-id SEARCH_ID`` option. |
| 139 |
Multiple IDs can be specified by simply repeating the option several times. |
| 140 |
- You can supply ``--set field=value`` to assign ``field`` to ``value`` on |
| 141 |
import. Values support the same template syntax as beets' :doc:`path formats |
| 142 |
<pathformat>`. |
| 143 |
|
| 144 |
These assignments will merge with (and possibly override) the |
| 145 |
:ref:`set_fields` configuration dictionary. You can use the option multiple |
| 146 |
times on the command line, like so: |
| 147 |
|
| 148 |
.. code-block:: sh |
| 149 |
|
| 150 |
beet import --set genres="Alternative Rock" --set mood="emotional" |
| 151 |
|
| 152 |
.. _py7zr: https://pypi.org/project/py7zr/ |
| 153 |
|
| 154 |
.. _rarfile: https://pypi.org/project/rarfile/ |
| 155 |
|
| 156 |
.. only:: html |
| 157 |
|
| 158 |
.. _reimport: |
| 159 |
|
| 160 |
Reimporting |
| 161 |
^^^^^^^^^^^ |
| 162 |
|
| 163 |
The ``import`` command can also be used to "reimport" music that you've |
| 164 |
already added to your library. This is useful when you change your mind |
| 165 |
about some selections you made during the initial import, or if you prefer |
| 166 |
to import everything "as-is" and then correct tags later. |
| 167 |
|
| 168 |
Just point the ``beet import`` command at a directory of files that are |
| 169 |
already catalogged in your library. Beets will automatically detect this |
| 170 |
situation and avoid duplicating any items. In this situation, the "copy |
| 171 |
files" option (``-c``/``-C`` on the command line or ``copy`` in the |
| 172 |
config file) has slightly different behavior: it causes files to be *moved*, |
| 173 |
rather than duplicated, if they're already in your library. (The same is |
| 174 |
true, of course, if ``move`` is enabled.) That is, your directory |
| 175 |
structure will be updated to reflect the new tags if copying is enabled; you |
| 176 |
never end up with two copies of the file. |
| 177 |
|
| 178 |
Using ``-C`` (don't copy) in combination with ``-M`` (don't move) will retag |
| 179 |
music while leaving the files where they are. This is useful for players/music |
| 180 |
servers that get confused when an item changes path and tags at the same time. |
| 181 |
One can later use the :ref:`move-cmd` command to move items based on their new tags. |
| 182 |
|
| 183 |
The ``-L`` (``--library``) flag is also useful for retagging. Instead of |
| 184 |
listing paths you want to import on the command line, specify a :doc:`query |
| 185 |
string <query>` that matches items from your library. In this case, the |
| 186 |
``-s`` (singleton) flag controls whether the query matches individual items |
| 187 |
or full albums. If you want to retag your whole library, just supply a null |
| 188 |
query, which matches everything: ``beet import -L`` |
| 189 |
|
| 190 |
Note that, if you just want to update your files' tags according to |
| 191 |
changes in the MusicBrainz database, the :doc:`/plugins/mbsync` is a |
| 192 |
better choice. Reimporting uses the full matching machinery to guess |
| 193 |
metadata matches; ``mbsync`` just relies on MusicBrainz IDs. |
| 194 |
|
| 195 |
.. _list-cmd: |
| 196 |
|
| 197 |
list |
| 198 |
~~~~ |
| 199 |
|
| 200 |
:: |
| 201 |
|
| 202 |
beet list [-apf] [-l LIMIT] QUERY |
| 203 |
|
| 204 |
:doc:`Queries <query>` the database for music. |
| 205 |
|
| 206 |
Want to search for "Gronlandic Edit" by of Montreal? Try ``beet list |
| 207 |
gronlandic``. Maybe you want to see everything released in 2009 with |
| 208 |
"vegetables" in the title? Try ``beet list year:2009 title:vegetables``. You can |
| 209 |
also specify the sort order. (Read more in :doc:`query`.) |
| 210 |
|
| 211 |
You can use the ``-a`` switch to search for albums instead of individual items. |
| 212 |
In this case, the queries you use are restricted to album-level fields: for |
| 213 |
example, you can search for ``year:1969`` but query parts for item-level fields |
| 214 |
like ``title:foo`` will be ignored. Remember that ``artist`` is an item-level |
| 215 |
field; ``albumartist`` is the corresponding album field. |
| 216 |
|
| 217 |
Use the ``-l LIMIT`` (``--limit=LIMIT``) flag when you want to cap the maximum |
| 218 |
number of items that are returned. |
| 219 |
|
| 220 |
The ``-p`` option makes beets print out filenames of matched items, which might |
| 221 |
be useful for piping into other Unix commands (such as `xargs |
| 222 |
<https://en.wikipedia.org/wiki/Xargs>`__). Similarly, the ``-f`` option lets you |
| 223 |
specify a specific format with which to print every album or track. This uses |
| 224 |
the same template syntax as beets' :doc:`path formats <pathformat>`. For |
| 225 |
example, the command ``beet ls -af '$album: $albumtotal' beatles`` prints out |
| 226 |
the number of tracks on each Beatles album. In Unix shells, remember to enclose |
| 227 |
the template argument in single quotes to avoid environment variable expansion. |
| 228 |
|
| 229 |
.. _remove-cmd: |
| 230 |
|
| 231 |
remove |
| 232 |
~~~~~~ |
| 233 |
|
| 234 |
:: |
| 235 |
|
| 236 |
beet remove [-adf] QUERY |
| 237 |
|
| 238 |
Remove music from your library. |
| 239 |
|
| 240 |
This command uses the same :doc:`query <query>` syntax as the ``list`` command. |
| 241 |
By default, it just removes entries from the library database; it doesn't touch |
| 242 |
the files on disk. To actually delete the files, use the ``-d`` flag. When the |
| 243 |
``-a`` flag is given, the command operates on albums instead of individual |
| 244 |
tracks. |
| 245 |
|
| 246 |
When you run the ``remove`` command, it prints a list of all affected items in |
| 247 |
the library and asks for your permission before removing them. You can then |
| 248 |
choose to abort (type ``n``), confirm (``y``), or interactively choose some of |
| 249 |
the items (``s``). In the latter case, the command will prompt you for every |
| 250 |
matching item or album and invite you to type ``y`` to remove the item/album, |
| 251 |
``n`` to keep it or ``q`` to exit and only remove the items/albums selected up |
| 252 |
to this point. |
| 253 |
|
| 254 |
This option lets you choose precisely which tracks/albums to remove without |
| 255 |
spending too much time to carefully craft a query. If you do not want to be |
| 256 |
prompted at all, use the ``-f`` option. |
| 257 |
|
| 258 |
.. _modify-cmd: |
| 259 |
|
| 260 |
modify |
| 261 |
~~~~~~ |
| 262 |
|
| 263 |
:: |
| 264 |
|
| 265 |
beet modify [-IMWay] [-f FORMAT] QUERY [FIELD=VALUE...] [FIELD+=VALUE...] [FIELD-=VALUE...] [FIELD!...] |
| 266 |
|
| 267 |
Change the metadata for items or albums in the database. |
| 268 |
|
| 269 |
Supply a :doc:`query <query>` matching the things you want to change and a |
| 270 |
series of ``field=value`` pairs. For example, ``beet modify genius of love |
| 271 |
artist="Tom Tom Club"`` will change the artist for the track "Genius of Love." |
| 272 |
To remove fields (which is only possible for flexible attributes), follow a |
| 273 |
field name with an exclamation point: ``field!``. |
| 274 |
|
| 275 |
Values can also be *templates*, using the same syntax as :doc:`path formats |
| 276 |
<pathformat>`. For example, ``beet modify artist='$artist_sort'`` will copy the |
| 277 |
artist sort name into the artist field for all your tracks, and ``beet modify |
| 278 |
title='$track $title'`` will add track numbers to their title metadata. |
| 279 |
|
| 280 |
To adjust a multi-valued field, such as ``genres``, ``remixers``, ``lyricists``, |
| 281 |
``composers``, or ``arrangers``, separate the values with |semicolon_space|. For |
| 282 |
example, ``beet modify genres="rock; pop"``. |
| 283 |
|
| 284 |
For these multi-valued fields, you can also use ``+=`` to add values and ``-=`` |
| 285 |
to remove values, instead of replacing the whole field. For example, ``beet |
| 286 |
modify genres+=Funk`` adds "Funk" to the existing genres (without duplicating it |
| 287 |
if already present), and ``beet modify genres-=Pop`` removes "Pop" from the |
| 288 |
list, leaving the other values untouched. These operators are only valid for |
| 289 |
multi-valued fields. |
| 290 |
|
| 291 |
When modifying albums with ``-a``, multi-valued fields such as ``artists``, |
| 292 |
``genres``, ``composers`` are also supported with the same semicolon-separated |
| 293 |
syntax. |
| 294 |
|
| 295 |
For compatibility, ``modify`` assignments and query expressions still accept |
| 296 |
legacy singular names such as ``genre``, ``composer``, ``lyricist``, |
| 297 |
``remixer``, and ``arranger``, but beets will warn and translate them to the |
| 298 |
plural multi-valued fields. Prefer the plural field names in new commands. |
| 299 |
|
| 300 |
The ``-a`` option changes to querying album fields instead of track fields and |
| 301 |
also enables to operate on albums in addition to the individual tracks. Without |
| 302 |
this flag, the command will only change *track-level* data, even if all the |
| 303 |
tracks belong to the same album. If you want to change an *album-level* field, |
| 304 |
such as ``year`` or ``albumartist``, you'll want to use the ``-a`` flag to avoid |
| 305 |
a confusing situation where the data for individual tracks conflicts with the |
| 306 |
data for the whole album. |
| 307 |
|
| 308 |
Modifications issued using ``-a`` by default cascade to individual tracks. To |
| 309 |
prevent this behavior, use ``-I``/``--noinherit``. |
| 310 |
|
| 311 |
Items will automatically be moved around when necessary if they're in your |
| 312 |
library directory, but you can disable that with ``-M``. Tags will be written to |
| 313 |
the files according to the settings you have for imports, but these can be |
| 314 |
overridden with ``-w`` (write tags, the default) and ``-W`` (don't write tags). |
| 315 |
|
| 316 |
When you run the ``modify`` command, it prints a list of all affected items in |
| 317 |
the library and asks for your permission before making any changes. You can then |
| 318 |
choose to abort the change (type ``n``), confirm (``y``), or interactively |
| 319 |
choose some of the items (``s``). In the latter case, the command will prompt |
| 320 |
you for every matching item or album and invite you to type ``y`` to apply the |
| 321 |
changes, ``n`` to discard them or ``q`` to exit and apply the selected changes. |
| 322 |
This option lets you choose precisely which data to change without spending too |
| 323 |
much time to carefully craft a query. To skip the prompts entirely, use the |
| 324 |
``-y`` option. |
| 325 |
|
| 326 |
.. _move-cmd: |
| 327 |
|
| 328 |
move |
| 329 |
~~~~ |
| 330 |
|
| 331 |
:: |
| 332 |
|
| 333 |
beet move [-capt] [-d DIR] QUERY |
| 334 |
|
| 335 |
Move or copy items in your library. |
| 336 |
|
| 337 |
This command, by default, acts as a library consolidator: items matching the |
| 338 |
query are renamed into your library directory structure. By specifying a |
| 339 |
destination directory with ``-d`` manually, you can move items matching a query |
| 340 |
anywhere in your filesystem. The ``-c`` option copies files instead of moving |
| 341 |
them. As with other commands, the ``-a`` option matches albums instead of items. |
| 342 |
The ``-e`` flag (for "export") copies files without changing the database. |
| 343 |
|
| 344 |
To perform a "dry run", just use the ``-p`` (for "pretend") flag. This will show |
| 345 |
you a list of files that would be moved but won't actually change anything on |
| 346 |
disk. The ``-t`` option sets the timid mode which will ask again before really |
| 347 |
moving or copying the files. |
| 348 |
|
| 349 |
.. _update-cmd: |
| 350 |
|
| 351 |
update |
| 352 |
~~~~~~ |
| 353 |
|
| 354 |
:: |
| 355 |
|
| 356 |
beet update [-F] FIELD [-e] EXCLUDE_FIELD [-aMp] QUERY |
| 357 |
|
| 358 |
Update the library (and, by default, move files) to reflect out-of-band metadata |
| 359 |
changes and file deletions. |
| 360 |
|
| 361 |
This will scan all the matched files and read their tags, populating the |
| 362 |
database with the new values. By default, files will be renamed according to |
| 363 |
their new metadata; disable this with ``-M``. Beets will skip files if their |
| 364 |
modification times have not changed, so any out-of-band metadata changes must |
| 365 |
also update these for ``beet update`` to recognise that the files have been |
| 366 |
edited. |
| 367 |
|
| 368 |
To perform a "dry run" of an update, just use the ``-p`` (for "pretend") flag. |
| 369 |
This will show you all the proposed changes but won't actually change anything |
| 370 |
on disk. |
| 371 |
|
| 372 |
By default, all the changed metadata will be populated back to the database. If |
| 373 |
you only want certain fields to be written, specify them with the ``-F`` flags |
| 374 |
(which can be used multiple times). Alternatively, specify fields to *not* write |
| 375 |
with ``-e`` flags (which can be used multiple times). For the list of supported |
| 376 |
fields, please see ``beet fields``. |
| 377 |
|
| 378 |
When an updated track is part of an album, the album-level fields of *all* |
| 379 |
tracks from the album are also updated. (Specifically, the command copies |
| 380 |
album-level data from the first track on the album and applies it to the rest of |
| 381 |
the tracks.) This means that, if album-level fields aren't identical within an |
| 382 |
album, some changes shown by the ``update`` command may be overridden by data |
| 383 |
from other tracks on the same album. This means that running the ``update`` |
| 384 |
command multiple times may show the same changes being applied. |
| 385 |
|
| 386 |
.. _write-cmd: |
| 387 |
|
| 388 |
write |
| 389 |
~~~~~ |
| 390 |
|
| 391 |
:: |
| 392 |
|
| 393 |
beet write [-pf] [QUERY] |
| 394 |
|
| 395 |
Write metadata from the database into files' tags. |
| 396 |
|
| 397 |
When you make changes to the metadata stored in beets' library database (during |
| 398 |
import or with the :ref:`modify-cmd` command, for example), you often have the |
| 399 |
option of storing changes only in the database, leaving your files untouched. |
| 400 |
The ``write`` command lets you later change your mind and write the contents of |
| 401 |
the database into the files. By default, this writes the changes only if there |
| 402 |
is a difference between the database and the tags in the file. |
| 403 |
|
| 404 |
You can think of this command as the opposite of :ref:`update-cmd`. |
| 405 |
|
| 406 |
The ``-p`` option previews metadata changes without actually applying them. |
| 407 |
|
| 408 |
The ``-f`` option forces a write to the file, even if the file tags match the |
| 409 |
database. This is useful for making sure that enabled plugins that run on write |
| 410 |
(e.g., the Scrub and Zero plugins) are run on the file. |
| 411 |
|
| 412 |
.. _stats-cmd: |
| 413 |
|
| 414 |
stats |
| 415 |
~~~~~ |
| 416 |
|
| 417 |
:: |
| 418 |
|
| 419 |
beet stats [-e] [QUERY] |
| 420 |
|
| 421 |
Show some statistics on your entire library (if you don't provide a :doc:`query |
| 422 |
<query>`) or the matched items (if you do). |
| 423 |
|
| 424 |
By default, the command calculates file sizes using their bitrate and duration. |
| 425 |
The ``-e`` (``--exact``) option reads the exact sizes of each file (but is |
| 426 |
slower). The exact mode also outputs the exact duration in seconds. |
| 427 |
|
| 428 |
.. _fields-cmd: |
| 429 |
|
| 430 |
fields |
| 431 |
~~~~~~ |
| 432 |
|
| 433 |
:: |
| 434 |
|
| 435 |
beet fields |
| 436 |
|
| 437 |
Show the item and album metadata fields available for use in :doc:`query` and |
| 438 |
:doc:`pathformat`. The listing includes any template fields provided by plugins |
| 439 |
and any flexible attributes you've manually assigned to your items and albums. |
| 440 |
|
| 441 |
.. _config-cmd: |
| 442 |
|
| 443 |
config |
| 444 |
~~~~~~ |
| 445 |
|
| 446 |
:: |
| 447 |
|
| 448 |
beet config [-pdc] |
| 449 |
beet config -e |
| 450 |
|
| 451 |
Show or edit the user configuration. This command does one of three things: |
| 452 |
|
| 453 |
- With no options, print a YAML representation of the current user |
| 454 |
configuration. With the ``--default`` option, beets' default options are also |
| 455 |
included in the dump. |
| 456 |
- The ``--path`` option instead shows the path to your configuration file. This |
| 457 |
can be combined with the ``--default`` flag to show where beets keeps its |
| 458 |
internal defaults. |
| 459 |
- By default, sensitive information like passwords is removed when dumping the |
| 460 |
configuration. The ``--clear`` option includes this sensitive data. |
| 461 |
- With the ``--edit`` option, beets attempts to open your config file for |
| 462 |
editing. It first tries the ``$EDITOR`` environment variable, followed by |
| 463 |
``$EDITOR`` and then a fallback option depending on your platform: ``open`` on |
| 464 |
OS X, ``xdg-open`` on Unix, and direct invocation on Windows. |
| 465 |
|
| 466 |
.. _global-flags: |
| 467 |
|
| 468 |
Global Flags |
| 469 |
------------ |
| 470 |
|
| 471 |
Beets has a few "global" flags that affect all commands. These must appear |
| 472 |
between the executable name (``beet``) and the command---for example, ``beet -v |
| 473 |
import ...``. |
| 474 |
|
| 475 |
- ``-l LIBPATH``: specify the library database file to use. |
| 476 |
- ``-d DIRECTORY``: specify the library root directory. |
| 477 |
- ``-v``: verbose mode; prints out a deluge of debugging information. Please use |
| 478 |
this flag when reporting bugs. You can use it twice, as in ``-vv``, to make |
| 479 |
beets even more verbose. |
| 480 |
- ``-c FILE``: read a specified YAML :doc:`configuration file <config>`. This |
| 481 |
configuration works as an overlay: rather than replacing your normal |
| 482 |
configuration options entirely, the two are merged. Any individual options set |
| 483 |
in this config file will override the corresponding settings in your base |
| 484 |
configuration. |
| 485 |
- ``-p plugins``: specify a comma-separated list of plugins to enable. If |
| 486 |
specified, the plugin list in your configuration is ignored. The long form of |
| 487 |
this argument also allows specifying no plugins, effectively disabling all |
| 488 |
plugins: ``--plugins=``. |
| 489 |
- ``-P plugins``: specify a comma-separated list of plugins to disable in a |
| 490 |
specific beets run. This will overwrite ``-p`` if used with it. To disable all |
| 491 |
plugins, use ``--plugins=`` instead. |
| 492 |
|
| 493 |
Beets also uses the ``BEETSDIR`` environment variable to look for configuration |
| 494 |
and data. |
| 495 |
|
| 496 |
.. _completion: |
| 497 |
|
| 498 |
Shell Completion |
| 499 |
---------------- |
| 500 |
|
| 501 |
Beets includes support for shell command completion. The command ``beet |
| 502 |
completion`` prints out a bash_ 3.2 script; to enable completion put a line like |
| 503 |
this into your ``.bashrc`` or similar file: |
| 504 |
|
| 505 |
:: |
| 506 |
|
| 507 |
eval "$(beet completion)" |
| 508 |
|
| 509 |
Or, to avoid slowing down your shell startup time, you can pipe the ``beet |
| 510 |
completion`` output to a file and source that instead. |
| 511 |
|
| 512 |
You will also need to source the bash-completion_ script, which is probably |
| 513 |
available via your package manager. On OS X, you can install it via Homebrew |
| 514 |
with ``brew install bash-completion``; Homebrew will give you instructions for |
| 515 |
sourcing the script. |
| 516 |
|
| 517 |
.. _bash: https://www.gnu.org/software/bash/ |
| 518 |
|
| 519 |
.. _bash-completion: https://github.com/scop/bash-completion |
| 520 |
|
| 521 |
The completion script suggests names of subcommands and (after typing ``-``) |
| 522 |
options of the given command. If you are using a command that accepts a query, |
| 523 |
the script will also complete field names. |
| 524 |
|
| 525 |
:: |
| 526 |
|
| 527 |
beet list ar[TAB] |
| 528 |
# artist: artist_credit: artist_sort: artpath: |
| 529 |
beet list artp[TAB] |
| 530 |
beet list artpath\: |
| 531 |
|
| 532 |
(Don't worry about the slash in front of the colon: this is a escape sequence |
| 533 |
for the shell and won't be seen by beets.) |
| 534 |
|
| 535 |
Completion of plugin commands only works for those plugins that were enabled |
| 536 |
when running ``beet completion``. If you add a plugin later on you will want to |
| 537 |
re-generate the script. |
| 538 |
|
| 539 |
zsh |
| 540 |
~~~ |
| 541 |
|
| 542 |
If you use zsh, take a look at the included `completion script`_. The script |
| 543 |
should be placed in a directory that is part of your ``fpath``, and ``not`` |
| 544 |
sourced in your ``.zshrc``. Running ``echo $fpath`` will give you a list of |
| 545 |
valid directories. |
| 546 |
|
| 547 |
Another approach is to use zsh's bash completion compatibility. This snippet |
| 548 |
defines some bash-specific functions to make this work without errors: |
| 549 |
|
| 550 |
:: |
| 551 |
|
| 552 |
autoload bashcompinit |
| 553 |
bashcompinit |
| 554 |
_get_comp_words_by_ref() { :; } |
| 555 |
compopt() { :; } |
| 556 |
_filedir() { :; } |
| 557 |
eval "$(beet completion)" |
| 558 |
|
| 559 |
.. _completion script: https://github.com/beetbox/beets/blob/master/extra/_beet |
| 560 |
|
| 561 |
.. only:: man |
| 562 |
|
| 563 |
See Also |
| 564 |
-------- |
| 565 |
|
| 566 |
``https://beets.readthedocs.org/`` |
| 567 |
|
| 568 |
:manpage:`beetsconfig(5)` |