Debian Codegraph @

docs/plugins/types.rst

raw
1 Types Plugin
2 ============
3
4 The ``types`` plugin lets you declare types for attributes you use in your
5 library. For example, you can declare that a ``rating`` field is numeric so that
6 you can query it with ranges---which isn't possible when the field is considered
7 a string (the default).
8
9 Enable the ``types`` plugin as described in :doc:`/plugins/index` and then add a
10 ``types`` section to your :doc:`configuration file </reference/config>`. The
11 configuration section should map field name to one of ``int``, ``float``,
12 ``bool``, or ``date``.
13
14 Here's an example:
15
16 ::
17
18 types:
19 rating: int
20
21 Now you can assign numeric ratings to tracks and albums and use :ref:`range
22 queries <numericquery>` to filter them.:
23
24 ::
25
26 beet modify "My favorite track" rating=5
27 beet ls rating:4..5
28
29 beet modify --album "My favorite album" rating=5
30 beet ls --album rating:4..5