<commit_before>Bad Files Plugin
================

The ``badfiles`` plugin adds a ``beet bad`` command to check for missing and
corrupt files.

Configuring
-----------

First, enable the ``badfiles`` plugin (see :ref:`using-plugins`). The default
configuration defines the following default checkers, which you may need to
install yourself:

* `mp3val`_ for MP3 files
* `FLAC`_ command-line tools for FLAC files

You can also add custom commands for a specific extension, like this::

    badfiles:
        commands:
            ogg: myoggchecker --opt1 --opt2
            flac: flac --test --warnings-as-errors --silent

.. _mp3val: http://mp3val.sourceforge.net/
.. _flac: https://xiph.org/flac/

Using
-----

Type ``beet bad`` with a query according to beets' usual query syntax. For
instance, this will run a check on all songs containing the word "wolf"::
<commit_msg>badfiles: Update doc about checker commands<commit_after>Bad Files Plugin
================

The ``badfiles`` plugin adds a ``beet bad`` command to check for missing and
corrupt files.

Configuring
-----------

First, enable the ``badfiles`` plugin (see :ref:`using-plugins`). The default
configuration defines the following default checkers, which you may need to
install yourself:

* `mp3val`_ for MP3 files
* `FLAC`_ command-line tools for FLAC files

You can also add custom commands for a specific extension, like this::

    badfiles:
        commands:
            ogg: myoggchecker --opt1 --opt2
            flac: flac --test --warnings-as-errors --silent

Custom commands will be run once for each file of the specified type, with the
path to the file as the last argument. Commands must return a status code
greater than zero for a file to be considered corrupt.

.. _mp3val: http://mp3val.sourceforge.net/
.. _flac: https://xiph.org/flac/

Using
-----

Type ``beet bad`` with a query according to beets' usual query syntax. For
instance, this will run a check on all songs containing the word "wolf"::

{'fraction_non_alphanumeric': 0.11699445284921836, 'fraction_numerical': 0.006051437216338881, 'mean_word_length': 3.3508771929824563, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6057243', 'n_tokens_mistral': 571, 'n_tokens_neox': 559, 'n_words': 254}