| 1 |
Bad Files Plugin |
| 2 |
================ |
| 3 |
|
| 4 |
The ``badfiles`` plugin adds a ``beet bad`` command to check for missing and |
| 5 |
corrupt files. |
| 6 |
|
| 7 |
Configuring |
| 8 |
----------- |
| 9 |
|
| 10 |
First, enable the ``badfiles`` plugin (see :ref:`using-plugins`). The default |
| 11 |
configuration defines the following default checkers, which you may need to |
| 12 |
install yourself: |
| 13 |
|
| 14 |
- mp3val_ for MP3 files |
| 15 |
- FLAC_ command-line tools for FLAC files |
| 16 |
|
| 17 |
You can also add custom commands for a specific extension, like this: |
| 18 |
|
| 19 |
:: |
| 20 |
|
| 21 |
badfiles: |
| 22 |
check_on_import: yes |
| 23 |
import_action_on_error: skip |
| 24 |
import_action_on_warning: continue |
| 25 |
commands: |
| 26 |
ogg: myoggchecker --opt1 --opt2 |
| 27 |
flac: flac --test --warnings-as-errors --silent |
| 28 |
|
| 29 |
Custom commands will be run once for each file of the specified type, with the |
| 30 |
path to the file as the last argument. Commands must return a status code |
| 31 |
greater than zero for a file to be considered corrupt. |
| 32 |
|
| 33 |
You can run the checkers when importing files by using the ``check_on_import`` |
| 34 |
option. When on, checkers will be run against every imported file and warnings |
| 35 |
and errors will be presented when selecting a tagging option. |
| 36 |
|
| 37 |
``import_action_on_error`` and ``import_action_on_warning`` can be used to take |
| 38 |
automatic action on warnings and errors. Both options default to ``ask``. Valid |
| 39 |
options for both ``import_action_on_(warning|error)`` are ``ask skip abort |
| 40 |
continue``. |
| 41 |
|
| 42 |
.. _flac: https://xiph.org/flac/ |
| 43 |
|
| 44 |
.. _mp3val: https://sourceforge.net/projects/mp3val/ |
| 45 |
|
| 46 |
Using |
| 47 |
----- |
| 48 |
|
| 49 |
Type ``beet bad`` with a query according to beets' usual query syntax. For |
| 50 |
instance, this will run a check on all songs containing the word "wolf": |
| 51 |
|
| 52 |
:: |
| 53 |
|
| 54 |
beet bad wolf |
| 55 |
|
| 56 |
This one will run checks on a specific album: |
| 57 |
|
| 58 |
:: |
| 59 |
|
| 60 |
beet bad album_id:1234 |
| 61 |
|
| 62 |
Here is an example where the FLAC decoder signals a corrupt file: |
| 63 |
|
| 64 |
:: |
| 65 |
|
| 66 |
beet bad title::^$ |
| 67 |
/tank/Music/__/00.flac: command exited with status 1 |
| 68 |
00.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH |
| 69 |
00.flac: ERROR while decoding data |
| 70 |
state = FLAC__STREAM_DECODER_READ_FRAME |
| 71 |
|
| 72 |
Note that the default ``mp3val`` checker is a bit verbose and can output a lot |
| 73 |
of "stream error" messages, even for files that play perfectly well. Generally, |
| 74 |
if more than one stream error happens, or if a stream error happens in the |
| 75 |
middle of a file, this is a bad sign. |
| 76 |
|
| 77 |
By default, only errors for the bad files will be shown. In order for the |
| 78 |
results for all of the checked files to be seen, including the uncorrupted ones, |
| 79 |
use the ``-v`` or ``--verbose`` option. |