mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 01:23:09 +01:00
Reorganize up some badfiles documentation
This commit is contained in:
parent
c756b3eedb
commit
ecf677ae41
2 changed files with 29 additions and 33 deletions
|
|
@ -30,7 +30,6 @@ import sys
|
||||||
|
|
||||||
|
|
||||||
class BadFiles(BeetsPlugin):
|
class BadFiles(BeetsPlugin):
|
||||||
|
|
||||||
def run_command(self, cmd):
|
def run_command(self, cmd):
|
||||||
self._log.debug("running command: {}",
|
self._log.debug("running command: {}",
|
||||||
displayable_path(list2cmdline(cmd)))
|
displayable_path(list2cmdline(cmd)))
|
||||||
|
|
@ -41,8 +40,7 @@ class BadFiles(BeetsPlugin):
|
||||||
return 1, [line for line in e.output.split("\n") if line]
|
return 1, [line for line in e.output.split("\n") if line]
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.ENOENT:
|
if e.errno == errno.ENOENT:
|
||||||
ui.print_("command not found: {}",
|
ui.print_("command not found: {}".format(cmd[0]))
|
||||||
cmd[0])
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
@ -77,12 +75,12 @@ class BadFiles(BeetsPlugin):
|
||||||
def check_bad(self, lib, opts, args):
|
def check_bad(self, lib, opts, args):
|
||||||
for item in lib.items(args):
|
for item in lib.items(args):
|
||||||
|
|
||||||
# First check if the path exists. If not, should run 'beets update'
|
# First, check whether the path exists. If not, the user
|
||||||
# to cleanup your library.
|
# should probably run `beet update` to cleanup your library.
|
||||||
dpath = displayable_path(item.path)
|
dpath = displayable_path(item.path)
|
||||||
self._log.debug("checking path: {}", dpath)
|
self._log.debug("checking path: {}", dpath)
|
||||||
if not os.path.exists(item.path):
|
if not os.path.exists(item.path):
|
||||||
ui.print_("{}: file does not exist", dpath)
|
ui.print_("{}: file does not exist".format(dpath))
|
||||||
|
|
||||||
# Run the checker against the file if one is found
|
# Run the checker against the file if one is found
|
||||||
ext = os.path.splitext(item.path)[1][1:]
|
ext = os.path.splitext(item.path)[1][1:]
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,35 @@
|
||||||
Bad Files Plugin
|
Bad Files Plugin
|
||||||
================
|
================
|
||||||
|
|
||||||
Adds a `beet bad` command to check for missing, and optionally corrupt files.
|
The ``badfiles`` plugin adds a ``beet bad`` command to check for missing and
|
||||||
|
corrupt files.
|
||||||
|
|
||||||
Configuration
|
Configuring
|
||||||
-------------
|
-----------
|
||||||
|
|
||||||
Here is a very basic configuration that uses the default commands for MP3 and
|
First, enable the ``badfiles`` plugin (see :ref:`using-plugins`). Then, add a
|
||||||
FLAC files, requiring the `mp3val`_ and
|
``badfiles:`` section to your configuration file, like so::
|
||||||
packages to be installed::
|
|
||||||
|
|
||||||
badfiles:
|
badfiles:
|
||||||
commands: {}
|
commands: {}
|
||||||
plugins: ... badfiles
|
|
||||||
|
|
||||||
Note that the *mp3val* checker is a bit verbose and can output a lot of "stream
|
This uses two default checkers: `mp3val`_ for MP3s and the ordinary `FLAC`_
|
||||||
error" messages, even for files that play perfectly well. Generally if more
|
command-line tools for those files. (You will need to install these yourself.)
|
||||||
than one stream error happens, or if a stream error happens in the middle of a
|
You can also add custom commands for a specific extension, like this::
|
||||||
file, this is a bad sign.
|
|
||||||
|
badfiles:
|
||||||
|
commands:
|
||||||
|
ogg: myoggchecker --opt1 --opt2
|
||||||
|
flac: flac --test --warnings-as-errors --silent
|
||||||
|
|
||||||
.. _mp3val: http://mp3val.sourceforge.net/
|
.. _mp3val: http://mp3val.sourceforge.net/
|
||||||
.. _flac: https://xiph.org/flac/
|
.. _flac: https://xiph.org/flac/
|
||||||
|
|
||||||
You can also add custom commands for a specific extension, e.g.::
|
Using
|
||||||
|
-----
|
||||||
|
|
||||||
badfiles:
|
Type ``beet bad`` with a query according to beets' usual query syntax. For
|
||||||
commands:
|
instance, this will run a check on all songs containing the word "wolf"::
|
||||||
ogg: myoggchecker --opt1 --opt2
|
|
||||||
flac: flac --test --warnings-as-errors --silent
|
|
||||||
plugins: ... badfiles
|
|
||||||
|
|
||||||
Running
|
|
||||||
-------
|
|
||||||
|
|
||||||
To run Badfiles, just use the ``beet bad`` command with Beets' usual query syntax.
|
|
||||||
|
|
||||||
For instance, this will run a check on all songs containing the word "wolf"::
|
|
||||||
|
|
||||||
beet bad wolf
|
beet bad wolf
|
||||||
|
|
||||||
|
|
@ -43,11 +37,15 @@ This one will run checks on a specific album::
|
||||||
|
|
||||||
beet bad album_id:1234
|
beet bad album_id:1234
|
||||||
|
|
||||||
Here is an example from my library where the FLAC decoder was signaling a
|
Here is an example where the FLAC decoder was signals a corrupt file::
|
||||||
corrupt file::
|
|
||||||
|
|
||||||
beet bad title::^$
|
beet bad title::^$
|
||||||
/tank/Music/__/00.flac: command exited with status 1
|
/tank/Music/__/00.flac: command exited with status 1
|
||||||
00.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
|
00.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
|
||||||
00.flac: ERROR while decoding data
|
00.flac: ERROR while decoding data
|
||||||
state = FLAC__STREAM_DECODER_READ_FRAME
|
state = FLAC__STREAM_DECODER_READ_FRAME
|
||||||
|
|
||||||
|
Note that the default `mp3val` checker is a bit verbose and can output a lot
|
||||||
|
of "stream error" messages, even for files that play perfectly well.
|
||||||
|
Generally, if more than one stream error happens, or if a stream error happens
|
||||||
|
in the middle of a file, this is a bad sign.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue