| 1 |
Titlecase Plugin |
| 2 |
================ |
| 3 |
|
| 4 |
The ``titlecase`` plugin lets you format tags and paths in accordance with the |
| 5 |
titlecase guidelines in the `New York Times Manual of Style`_ and uses the |
| 6 |
`python titlecase library`_. |
| 7 |
|
| 8 |
Motivation for this plugin comes from a desire to resolve differences in style |
| 9 |
between databases sources. For example, `MusicBrainz style`_ follows standard |
| 10 |
title case rules, except in the case of terms that are deemed generic, like |
| 11 |
"mix" and "remix". On the other hand, `Discogs guidelines`_ recommend |
| 12 |
capitalizing the first letter of each word, even for small words like "of" and |
| 13 |
"a". This plugin aims to achieve a middle ground between disparate approaches to |
| 14 |
casing, and bring more consistency to titles in your library. |
| 15 |
|
| 16 |
.. _discogs guidelines: https://support.discogs.com/hc/en-us/articles/360005006334-Database-Guidelines-1-General-Rules#Capitalization_And_Grammar |
| 17 |
|
| 18 |
.. _musicbrainz style: https://musicbrainz.org/doc/Style |
| 19 |
|
| 20 |
.. _new york times manual of style: https://search.worldcat.org/en/title/946964415 |
| 21 |
|
| 22 |
.. _python titlecase library: https://pypi.org/project/titlecase/ |
| 23 |
|
| 24 |
Installation |
| 25 |
------------ |
| 26 |
|
| 27 |
To use the ``titlecase`` plugin, first enable it in your configuration (see |
| 28 |
:ref:`using-plugins`). Then, install ``beets`` with ``titlecase`` extra: |
| 29 |
|
| 30 |
.. code-block:: bash |
| 31 |
|
| 32 |
pip install "beets[titlecase]" |
| 33 |
|
| 34 |
If you'd like to just use the path format expression, call ``%titlecase`` in |
| 35 |
your path formatter, and set ``auto`` to ``no`` in the configuration. |
| 36 |
|
| 37 |
:: |
| 38 |
|
| 39 |
paths: |
| 40 |
default: %titlecase{$albumartist}/%titlecase{$album}/$track $title |
| 41 |
|
| 42 |
You can now configure ``titlecase`` to your preference. |
| 43 |
|
| 44 |
Configuration |
| 45 |
------------- |
| 46 |
|
| 47 |
This plugin offers several configuration options to tune its function to your |
| 48 |
preference. |
| 49 |
|
| 50 |
Default |
| 51 |
~~~~~~~ |
| 52 |
|
| 53 |
.. code-block:: yaml |
| 54 |
|
| 55 |
titlecase: |
| 56 |
auto: yes |
| 57 |
fields: [] |
| 58 |
preserve: [] |
| 59 |
replace: [] |
| 60 |
separators: [] |
| 61 |
force_lowercase: no |
| 62 |
small_first_last: yes |
| 63 |
the_artist: yes |
| 64 |
all_lowercase: no |
| 65 |
all_caps: no |
| 66 |
after_choice: no |
| 67 |
|
| 68 |
.. conf:: auto |
| 69 |
:default: yes |
| 70 |
|
| 71 |
Whether to automatically apply titlecase to new imports. |
| 72 |
|
| 73 |
.. conf:: fields |
| 74 |
:default: [] |
| 75 |
|
| 76 |
A list of fields to apply the titlecase logic to. You must specify the fields |
| 77 |
you want to have modified in order for titlecase to apply changes to metadata. |
| 78 |
|
| 79 |
A good starting point is below, which will titlecase album titles, track titles, and all artist fields. |
| 80 |
|
| 81 |
.. code-block:: yaml |
| 82 |
|
| 83 |
titlecase: |
| 84 |
fields: |
| 85 |
- album |
| 86 |
- title |
| 87 |
- albumartist |
| 88 |
- albumartist_credit |
| 89 |
- albumartist_sort |
| 90 |
- albumartists |
| 91 |
- albumartists_credit |
| 92 |
- albumartists_sort |
| 93 |
- artist |
| 94 |
- artist_credit |
| 95 |
- artist_sort |
| 96 |
- artists |
| 97 |
- artists_credit |
| 98 |
- artists_sort |
| 99 |
|
| 100 |
.. conf:: preserve |
| 101 |
:default: [] |
| 102 |
|
| 103 |
List of words and phrases to preserve the case of. Without specifying ``DJ`` on |
| 104 |
the list, titlecase will format it as ``Dj``, or specify ``The Beatles`` to make sure |
| 105 |
``With The Beatles`` is not capitalized as ``With the Beatles``. |
| 106 |
|
| 107 |
.. conf:: replace |
| 108 |
:default: [] |
| 109 |
|
| 110 |
The replace function takes place before any titlecasing occurs, and is intended to |
| 111 |
help normalize differences in puncuation styles. It accepts a list of tuples, with |
| 112 |
the first being the target, and the second being the replacement. |
| 113 |
|
| 114 |
An example configuration that enforces one style of quotation mark is below. |
| 115 |
|
| 116 |
.. code-block:: yaml |
| 117 |
|
| 118 |
titlecase: |
| 119 |
replace: |
| 120 |
- "’": "'" |
| 121 |
- "‘": "'" |
| 122 |
- "“": '"' |
| 123 |
- "”": '"' |
| 124 |
|
| 125 |
.. conf:: separators |
| 126 |
:default: [] |
| 127 |
|
| 128 |
A list of characters to treat as markers of new sentences. Helpful for split titles |
| 129 |
that might otherwise have a lowercase letter at the start of the second string. |
| 130 |
|
| 131 |
.. conf:: force_lowercase |
| 132 |
:default: no |
| 133 |
|
| 134 |
Force all strings to lowercase before applying titlecase, but can cause |
| 135 |
problems with all caps acronyms titlecase would otherwise recognize. |
| 136 |
|
| 137 |
.. conf:: small_first_last |
| 138 |
:default: yes |
| 139 |
|
| 140 |
An option from the base titlecase library. Controls capitalizing small words at the start |
| 141 |
of a sentence. With this turned off ``a`` and similar words will not be capitalized |
| 142 |
under any circumstance. |
| 143 |
|
| 144 |
.. conf:: the_artist |
| 145 |
:default: yes |
| 146 |
|
| 147 |
If a field name contains ``artist``, then any lowercase ``the`` will be |
| 148 |
capitalized. Useful for bands with ``The`` as part of the proper name, |
| 149 |
like ``Amyl and The Sniffers``. |
| 150 |
|
| 151 |
.. conf:: all_caps |
| 152 |
:default: no |
| 153 |
|
| 154 |
If the letters a-Z in a string are all caps, do not modify the string. Useful |
| 155 |
if you encounter a lot of acronyms. |
| 156 |
|
| 157 |
.. conf:: all_lowercase |
| 158 |
:default: no |
| 159 |
|
| 160 |
If the letters a-Z in a string are all lowercase, do not modify the string. |
| 161 |
Useful if you encounter a lot of stylized lowercase spellings, but otherwise |
| 162 |
want titlecase applied. |
| 163 |
|
| 164 |
.. conf:: after_choice |
| 165 |
:default: no |
| 166 |
|
| 167 |
By default, titlecase runs on the candidates that are received, adjusting them before |
| 168 |
you make your selection and creating different weight calculations. If you'd rather |
| 169 |
see the data as received from the database, set this to true to run after you make |
| 170 |
your tag choice. |
| 171 |
|
| 172 |
Dangerous Fields |
| 173 |
~~~~~~~~~~~~~~~~ |
| 174 |
|
| 175 |
``titlecase`` only ever modifies string fields, however, this doesn't prevent |
| 176 |
you from selecting a case sensitive field that another plugin or feature may |
| 177 |
rely on. |
| 178 |
|
| 179 |
In particular, including any of the following in your configuration could lead |
| 180 |
to unintended behavior: |
| 181 |
|
| 182 |
.. code-block:: bash |
| 183 |
|
| 184 |
acoustid_fingerprint |
| 185 |
acoustid_id |
| 186 |
artists_ids |
| 187 |
asin |
| 188 |
deezer_track_id |
| 189 |
format |
| 190 |
id |
| 191 |
isrc |
| 192 |
mb_workid |
| 193 |
mb_trackid |
| 194 |
mb_albumid |
| 195 |
mb_artistid |
| 196 |
mb_artistids |
| 197 |
mb_albumartistid |
| 198 |
mb_albumartistids |
| 199 |
mb_releasetrackid |
| 200 |
mb_releasegroupid |
| 201 |
bitrate_mode |
| 202 |
encoder_info |
| 203 |
encoder_settings |
| 204 |
|
| 205 |
Running Manually |
| 206 |
---------------- |
| 207 |
|
| 208 |
From the command line, type: |
| 209 |
|
| 210 |
:: |
| 211 |
|
| 212 |
$ beet titlecase [QUERY] |
| 213 |
|
| 214 |
Configuration is drawn from the config file. Without a query the operation will |
| 215 |
be applied to the entire collection. |