beets/docs/plugins/info.rst
Sam Thursfield 2fa3717731 Optimise FormattedMapping when querying a specific set of fields
This changes greatly improves the speed of `beet export` and `beet info`
when the `--include-keys` option is used. It also removes the globbing
feature of `--include-keys` that was added in #1295. (See #3762 for
discussion).

Listing all fields for an item requires querying the database to find
any flex attributes. This is slow when done for every item being
exported. We already have a way for the user to specify a fixed set
of keys, but we previously queried everything and filtered it afterwards.
The new approach is more efficient.

Code that iterates through all fields now have to handle invalid field
names. The export and info plugins output invalid fields as None.

Timings before:

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    13.26user 20.22system 0:34.01elapsed 98%CPU (0avgtext+0avgdata 52544maxresident)k

    > /usr/bin/time beet export -l  Bob Dylan
    12.93user 20.15system 0:33.58elapsed 98%CPU (0avgtext+0avgdata 53632maxresident)k

Timings after:

    > /usr/bin/time beet export -l  Bob Dylan
    13.33user 20.17system 0:34.02elapsed 98%CPU (0avgtext+0avgdata 53500maxresident)k

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    0.49user 0.07system 0:00.56elapsed 98%CPU (0avgtext+0avgdata 50496maxresident)k

Notice the dramatic speedup in the last example!
2021-05-01 23:41:09 +02:00

43 lines
1.5 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Info Plugin
===========
The ``info`` plugin provides a command that dumps the current tag values for
any file format supported by beets. It works like a supercharged version of
`mp3info`_ or `id3v2`_.
Enable the ``info`` plugin in your configuration (see :ref:`using-plugins`) and
then type::
$ beet info /path/to/music.flac
and the plugin will enumerate all the tags in the specified file. It also
accepts multiple filenames in a single command-line.
You can also enter a :doc:`query </reference/query>` to inspect music from
your library::
$ beet info beatles
If you just want to see specific properties you can use the
``--include-keys`` option to filter them. The argument is a
comma-separated list of field names. For example::
$ beet info -i 'title,mb_artistid' beatles
Will only show the ``title`` and ``mb_artistid`` properties. You can add the
``-i`` option multiple times to the command line.
Additional command-line options include:
* ``--library`` or ``-l``: Show data from the library database instead of the
files' tags.
* ``--summarize`` or ``-s``: Merge all the information from multiple files
into a single list of values. If the tags differ across the files, print
``[various]``.
* ``--format`` or ``-f``: Specify a specific format with which to print every
item. This uses the same template syntax as beets :doc:`path formats
</reference/pathformat>`.
* ``--keys-only`` or ``-k``: Show the name of the tags without the values.
.. _id3v2: http://id3v2.sourceforge.net
.. _mp3info: https://www.ibiblio.org/mp3info/