Debian Codegraph @

docs/plugins/bucket.rst

raw
1 Bucket Plugin
2 =============
3
4 The ``bucket`` plugin groups your files into buckets folders representing
5 *ranges*. This kind of organization can classify your music by periods of time
6 (e.g,. *1960s*, *1970s*, etc.), or divide overwhelmingly large folders into
7 smaller subfolders by grouping albums or artists alphabetically (e.g. *A-F*,
8 *G-M*, *N-Z*).
9
10 To use the ``bucket`` plugin, first enable it in your configuration (see
11 :ref:`using-plugins`). The plugin provides a :ref:`template function
12 <template-functions>` called ``%bucket`` for use in path format expressions:
13
14 ::
15
16 paths:
17 default: /%bucket{$year}/%bucket{$artist}/$albumartist-$album-$year
18
19 Then, define your ranges in the ``bucket:`` section of the config file:
20
21 ::
22
23 bucket:
24 bucket_alpha: ['A-F', 'G-M', 'N-Z']
25 bucket_year: ['1980s', '1990s', '2000s']
26
27 The ``bucket_year`` parameter is used for all substitutions occurring on the
28 ``$year`` field, while ``bucket_alpha`` takes care of textual fields.
29
30 The definition of a range is somewhat loose, and multiple formats are allowed:
31
32 - For alpha ranges: the range is defined by the lowest and highest (ASCII-wise)
33 alphanumeric characters in the string you provide. For example, ``ABCD``,
34 ``A-D``, ``A->D``, and ``[AD]`` are all equivalent.
35 - For year ranges: digits characters are extracted and the two extreme years
36 define the range. For example, ``1975-77``, ``1975,76,77`` and ``1975-1977``
37 are equivalent. If no upper bound is given, the range is extended to current
38 year (unless a later range is defined). For example, ``1975`` encompasses all
39 years from 1975 until now.
40
41 The ``%bucket`` template function guesses whether to use alpha- or year-style
42 buckets depending on the text it receives. It can guess wrong if, for example,
43 an artist or album happens to begin with four digits. Provide ``alpha`` as the
44 second argument to the template to avoid this automatic detection: for example,
45 use ``%bucket{$artist,alpha}``.
46
47 Configuration
48 -------------
49
50 To configure the plugin, make a ``bucket:`` section in your configuration file.
51 The available options are:
52
53 - **bucket_alpha**: Ranges to use for all substitutions occurring on textual
54 fields. Default: none.
55 - **bucket_alpha_regex**: A ``range: regex`` mapping (one per line) where
56 ``range`` is one of the ``bucket_alpha`` ranges and ``value`` is a regex that
57 overrides original range definition. Default: none.
58 - **bucket_year**: Ranges to use for all substitutions occurring on the
59 ``$year`` field. Default: none.
60 - **extrapolate**: Enable this if you want to group your files into multiple
61 year ranges without enumerating them all. This option will generate year
62 bucket names by reproducing characteristics of declared buckets. Default:
63 ``no``
64
65 Here's an example:
66
67 ::
68
69 bucket:
70 bucket_year: ['2000-05']
71 extrapolate: true
72 bucket_alpha: ['A - D', 'E - L', 'M - R', 'S - Z']
73 bucket_alpha_regex:
74 'A - D': ^[0-9a-dA-D…äÄ]
75
76 This configuration creates five-year ranges for any input year. The ``A - D``
77 bucket now matches also all artists starting with ä or Ä and 0 to 9 and …
78 (ellipsis). The other alpha buckets work as ranges.