Skip to content

Commit 1b26aa6

Browse files
committed
Make lyrics plugin documentation slightly more clear
1 parent fda3147 commit 1b26aa6

File tree

2 files changed

+68
-56
lines changed

2 files changed

+68
-56
lines changed

beetsplug/lyrics.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,10 @@ def __init__(self):
854854
"bing_lang_to": None,
855855
"google_API_key": None,
856856
"google_engine_ID": "009217259823014548361:lndtuqkycfu",
857-
"genius_api_key": "Ryq93pUGm8bM6eUWwD_M3NOFFDAtp2yEE7W"
858-
"76V-uFL5jks5dNvcGCdarqFjDhP9c",
857+
"genius_api_key": (
858+
"Ryq93pUGm8bM6eUWwD_M3NOFFDAtp2yEE7W"
859+
"76V-uFL5jks5dNvcGCdarqFjDhP9c"
860+
),
859861
"fallback": None,
860862
"force": False,
861863
"local": False,

docs/plugins/lyrics.rst

+64-54
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ and, optionally, the Google custom search API.
1010
.. _LRCLIB: https://lrclib.net/
1111

1212

13-
Fetch Lyrics During Import
14-
--------------------------
13+
Install
14+
-------
1515

16-
To automatically fetch lyrics for songs you import, first enable it in your
17-
configuration (see :ref:`using-plugins`). Then, install ``beets`` with
18-
``lyrics`` extra
16+
Firstly, enable ``lyrics`` plugin in your configuration (see
17+
:ref:`using-plugins`). Then, install ``beets`` with ``lyrics`` extra
1918

2019
.. code-block:: bash
2120
2221
pip install "beets[lyrics]"
2322
23+
Fetch Lyrics During Import
24+
--------------------------
25+
2426
When importing new files, beets will now fetch lyrics for files that don't
2527
already have them. The lyrics will be stored in the beets database. If the
2628
``import.write`` config option is on, then the lyrics will also be written to
@@ -30,45 +32,49 @@ Configuration
3032
-------------
3133

3234
To configure the plugin, make a ``lyrics:`` section in your
33-
configuration file. The available options are:
35+
configuration file. Default configuration:
36+
37+
.. code-block:: yaml
38+
39+
lyrics:
40+
auto: yes
41+
bing_client_secret: null
42+
bing_lang_from: []
43+
bing_lang_to: null
44+
fallback: null
45+
force: no
46+
google_API_key: null
47+
google_engine_ID: 009217259823014548361:lndtuqkycfu
48+
sources:
49+
- lrclib
50+
- google
51+
- genius
52+
- tekstowo
53+
synced: no
54+
55+
The available options are:
3456

3557
- **auto**: Fetch lyrics automatically during import.
36-
Default: ``yes``.
3758
- **bing_client_secret**: Your Bing Translation application password
38-
(to :ref:`lyrics-translation`)
59+
(see :ref:`lyrics-translation`)
3960
- **bing_lang_from**: By default all lyrics with a language other than
4061
``bing_lang_to`` are translated. Use a list of lang codes to restrict the set
4162
of source languages to translate.
42-
Default: ``[]``
4363
- **bing_lang_to**: Language to translate lyrics into.
44-
Default: None.
4564
- **fallback**: By default, the file will be left unchanged when no lyrics are
4665
found. Use the empty string ``''`` to reset the lyrics in such a case.
47-
Default: None.
4866
- **force**: By default, beets won't fetch lyrics if the files already have
4967
ones. To instead always fetch lyrics, set the ``force`` option to ``yes``.
50-
Default: ``no``.
5168
- **google_API_key**: Your Google API key (to enable the Google Custom Search
5269
backend).
53-
Default: None.
5470
- **google_engine_ID**: The custom search engine to use.
5571
Default: The `beets custom search engine`_, which gathers an updated list of
5672
sources known to be scrapeable.
5773
- **sources**: List of sources to search for lyrics. An asterisk ``*`` expands
58-
to all available sources.
59-
Default: ``lrclib google genius tekstowo``, i.e., all the available sources. The
60-
``google`` source will be automatically deactivated if no ``google_API_key``
61-
is setup.
62-
The ``google``, ``genius``, and ``tekstowo`` sources will only be enabled if
63-
BeautifulSoup is installed.
64-
- **synced**: Prefer synced lyrics over plain lyrics if a source offers them. Currently `lrclib` is the only source that provides them. Default: `no`.
65-
66-
Here's an example of ``config.yaml``::
67-
68-
lyrics:
69-
fallback: ''
70-
google_API_key: AZERTYUIOPQSDFGHJKLMWXCVBN1234567890_ab
71-
google_engine_ID: 009217259823014548361:lndtuqkycfu
74+
to all available sources. The ``google`` source will be automatically
75+
deactivated if no ``google_API_key`` is setup.
76+
- **synced**: Prefer synced lyrics over plain lyrics if a source offers them.
77+
Currently ``lrclib`` is the only source that provides them.
7278

7379
.. _beets custom search engine: https://www.google.com:443/cse/publicurl?cx=009217259823014548361:lndtuqkycfu
7480

@@ -83,46 +89,52 @@ by that band, and ``beet lyrics`` will get lyrics for my entire library. The
8389
lyrics will be added to the beets database and, if ``import.write`` is on,
8490
embedded into files' metadata.
8591

86-
The ``-p`` option to the ``lyrics`` command makes it print lyrics out to the
87-
console so you can view the fetched (or previously-stored) lyrics.
92+
The ``-p, --print`` option to the ``lyrics`` command makes it print lyrics out
93+
to the console so you can view the fetched (or previously-stored) lyrics.
8894

89-
The ``-f`` option forces the command to fetch lyrics, even for tracks that
90-
already have lyrics. Inversely, the ``-l`` option restricts operations
91-
to lyrics that are locally available, which show lyrics faster without using
92-
the network at all.
95+
The ``-f, --force`` option forces the command to fetch lyrics, even for tracks
96+
that already have lyrics. Inversely, the ``-l, --local`` option restricts
97+
operations to lyrics that are locally available, which show lyrics faster
98+
without using the network at all.
9399

94100
Rendering Lyrics into Other Formats
95101
-----------------------------------
96102

97-
The ``-r directory`` option renders all lyrics as `reStructuredText`_ (ReST)
98-
documents in ``directory`` (by default, the current directory). That
99-
directory, in turn, can be parsed by tools like `Sphinx`_ to generate HTML,
100-
ePUB, or PDF documents.
103+
The ``-r directory, --write-rest directory`` option renders all lyrics as
104+
`reStructuredText`_ (ReST) documents in ``directory`` (by default, the current
105+
directory). That directory, in turn, can be parsed by tools like `Sphinx`_ to
106+
generate HTML, ePUB, or PDF documents.
101107

102108
A minimal ``conf.py`` and ``index.rst`` files are created the first time the
103109
command is run. They are not overwritten on subsequent runs, so you can safely
104110
modify these files to customize the output.
105111

106-
.. _Sphinx: https://www.sphinx-doc.org/
107-
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
108-
109112
Sphinx supports various `builders
110113
<https://www.sphinx-doc.org/en/stable/builders.html>`_, but here are a
111114
few suggestions.
112115

113-
* Build an HTML version::
114116

115-
sphinx-build -b html . _build/html
117+
.. admonition:: Build an HTML version
118+
119+
::
116120

117-
* Build an ePUB3 formatted file, usable on ebook readers::
121+
sphinx-build -b html . _build/html
118122

119-
sphinx-build -b epub3 . _build/epub
123+
.. admonition:: Build an ePUB3 formatted file, usable on ebook readers
120124

121-
* Build a PDF file, which incidentally also builds a LaTeX file::
125+
::
122126

123-
sphinx-build -b latex %s _build/latex && make -C _build/latex all-pdf
127+
sphinx-build -b epub3 . _build/epub
124128

125-
.. _activate-google-custom-search:
129+
.. admonition:: Build a PDF file, which incidentally also builds a LaTeX file
130+
131+
::
132+
133+
sphinx-build -b latex %s _build/latex && make -C _build/latex all-pdf
134+
135+
136+
.. _Sphinx: https://www.sphinx-doc.org/
137+
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
126138

127139
Activate Google Custom Search
128140
------------------------------
@@ -134,24 +146,22 @@ default list, which includes it as long as you have an API key).
134146
If you use default ``google_engine_ID``, we recommend limiting the sources to
135147
``google`` as the other sources are already included in the Google results.
136148

137-
.. _register for a Google API key: https://console.developers.google.com/
138-
139149
Optionally, you can `define a custom search engine`_. Get your search engine's
140150
token and use it for your ``google_engine_ID`` configuration option. By
141151
default, beets use a list of sources known to be scrapeable.
142152

143-
.. _define a custom search engine: https://www.google.com/cse/all
144-
145153
Note that the Google custom search API is limited to 100 queries per day.
146154
After that, the lyrics plugin will fall back on other declared data sources.
147155

148-
.. _BeautifulSoup: https://www.crummy.com/software/BeautifulSoup/bs4/doc/
149-
150156
Activate Genius and Tekstowo.pl Lyrics
151157
--------------------------------------
152158

153159
These backends are enabled by default.
154160

161+
.. _register for a Google API key: https://console.developers.google.com/
162+
.. _define a custom search engine: https://www.google.com/cse/all
163+
164+
155165
.. _lyrics-translation:
156166

157167
Activate On-the-Fly Translation
@@ -161,6 +171,6 @@ You need to register for a Microsoft Azure Marketplace free account and
161171
to the `Microsoft Translator API`_. Follow the four steps process, specifically
162172
at step 3 enter ``beets`` as *Client ID* and copy/paste the generated
163173
*Client secret* into your ``bing_client_secret`` configuration, alongside
164-
``bing_lang_to`` target `language code`.
174+
``bing_lang_to`` target ``language code``.
165175

166176
.. _Microsoft Translator API: https://docs.microsoft.com/en-us/azure/cognitive-services/translator/translator-how-to-signup

0 commit comments

Comments
 (0)