| 1 |
Discogs Plugin |
| 2 |
============== |
| 3 |
|
| 4 |
The ``discogs`` plugin extends the autotagger's search capabilities to include |
| 5 |
matches from the Discogs_ database. |
| 6 |
|
| 7 |
Files can be imported as albums or as singletons. Since Discogs_ matches are |
| 8 |
always based on Discogs_ releases, the album tag is written even to singletons. |
| 9 |
This enhances the importers results when reimporting as (full or partial) albums |
| 10 |
later on. |
| 11 |
|
| 12 |
.. _discogs: https://discogs.com |
| 13 |
|
| 14 |
Genre Mapping |
| 15 |
------------- |
| 16 |
|
| 17 |
Discogs uses ``styles`` for the more specific classifications and ``genres`` for |
| 18 |
the broader ones. The plugin therefore uses Discogs ``styles`` as the primary |
| 19 |
source for the beets ``genres`` field, because beets treats ``genres`` as the |
| 20 |
main multi-valued genre field. |
| 21 |
|
| 22 |
The broader Discogs ``genres`` values are written to the beets ``style`` field. |
| 23 |
If :conf:`plugins.discogs:append_style_genre` is enabled, those broader Discogs |
| 24 |
``genres`` values are also appended to beets ``genres``. |
| 25 |
|
| 26 |
For example, a Discogs release with ``styles`` set to ``["Techno"]`` and |
| 27 |
``genres`` set to ``["Electronic"]`` becomes beets ``genres`` = ``["Techno"]`` |
| 28 |
and ``style`` = ``"Electronic"`` by default. With ``append_style_genre`` |
| 29 |
enabled, beets ``genres`` becomes ``["Techno", "Electronic"]``. |
| 30 |
|
| 31 |
Installation |
| 32 |
------------ |
| 33 |
|
| 34 |
To use the ``discogs`` plugin, first enable it in your configuration (see |
| 35 |
:ref:`using-plugins`). Then, install ``beets`` with ``discogs`` extra |
| 36 |
|
| 37 |
.. code-block:: bash |
| 38 |
|
| 39 |
pip install "beets[discogs]" |
| 40 |
|
| 41 |
You will also need to register for a Discogs_ account, and provide |
| 42 |
authentication credentials via a personal access token or an OAuth2 |
| 43 |
authorization. |
| 44 |
|
| 45 |
Matches from Discogs will now show up during import alongside matches from |
| 46 |
MusicBrainz. The search terms sent to the Discogs API are based on the artist |
| 47 |
and album tags of your tracks. If those are empty no query will be issued. |
| 48 |
|
| 49 |
If you have a Discogs ID for an album you want to tag, you can also enter it at |
| 50 |
the "enter Id" prompt in the importer. |
| 51 |
|
| 52 |
OAuth Authorization |
| 53 |
~~~~~~~~~~~~~~~~~~~ |
| 54 |
|
| 55 |
The first time you run the :ref:`import-cmd` command after enabling the plugin, |
| 56 |
it will ask you to authorize with Discogs by visiting the site in a browser. |
| 57 |
Subsequent runs will not require re-authorization. |
| 58 |
|
| 59 |
Authentication via Personal Access Token |
| 60 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 61 |
|
| 62 |
As an alternative to OAuth, you can get a token from Discogs and add it to your |
| 63 |
configuration. To get a personal access token (called a "user token" in the |
| 64 |
python3-discogs-client_ documentation): |
| 65 |
|
| 66 |
1. login to Discogs_; |
| 67 |
2. visit the `Developer settings page |
| 68 |
<https://www.discogs.com/settings/developers>`_; |
| 69 |
3. press the *Generate new token* button; |
| 70 |
4. copy the generated token; |
| 71 |
5. place it in your configuration in the ``discogs`` section as the |
| 72 |
``user_token`` option: |
| 73 |
|
| 74 |
.. code-block:: yaml |
| 75 |
|
| 76 |
discogs: |
| 77 |
user_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
| 78 |
|
| 79 |
Configuration |
| 80 |
------------- |
| 81 |
|
| 82 |
This plugin can be configured like other metadata source plugins as described in |
| 83 |
:ref:`metadata-source-plugin-configuration`. |
| 84 |
|
| 85 |
Default |
| 86 |
~~~~~~~ |
| 87 |
|
| 88 |
.. code-block:: yaml |
| 89 |
|
| 90 |
discogs: |
| 91 |
apikey: REDACTED |
| 92 |
apisecret: REDACTED |
| 93 |
tokenfile: discogs_token.json |
| 94 |
user_token: |
| 95 |
index_tracks: no |
| 96 |
append_style_genre: no |
| 97 |
separator: ', ' |
| 98 |
strip_disambiguation: yes |
| 99 |
featured_string: Feat. |
| 100 |
extra_tags: [] |
| 101 |
anv: |
| 102 |
artist_credit: yes |
| 103 |
artist: no |
| 104 |
album_artist: no |
| 105 |
data_source_mismatch_penalty: 0.5 |
| 106 |
search_limit: 5 |
| 107 |
|
| 108 |
.. conf:: index_tracks |
| 109 |
:default: no |
| 110 |
|
| 111 |
Index tracks (see the `Discogs guidelines`_) along with headers, mark divisions |
| 112 |
between distinct works on the same release or within works. When enabled, |
| 113 |
beets will incorporate the names of the divisions containing each track into the |
| 114 |
imported track's title. |
| 115 |
|
| 116 |
For example, importing `divisions album`_ would result in track names like: |
| 117 |
|
| 118 |
.. code-block:: text |
| 119 |
|
| 120 |
Messiah, Part I: No.1: Sinfony |
| 121 |
Messiah, Part II: No.22: Chorus- Behold The Lamb Of God |
| 122 |
Athalia, Act I, Scene I: Sinfonia |
| 123 |
|
| 124 |
whereas with ``index_tracks`` disabled you'd get: |
| 125 |
|
| 126 |
.. code-block:: text |
| 127 |
|
| 128 |
No.1: Sinfony |
| 129 |
No.22: Chorus- Behold The Lamb Of God |
| 130 |
Sinfonia |
| 131 |
|
| 132 |
This option is useful when importing classical music. |
| 133 |
|
| 134 |
.. conf:: append_style_genre |
| 135 |
:default: no |
| 136 |
|
| 137 |
Appends the broader Discogs ``genres`` values to beets ``genres`` after |
| 138 |
the specific Discogs ``styles`` values already stored there. See the |
| 139 |
Genre Mapping section above for the default field mapping and an example. |
| 140 |
|
| 141 |
.. conf:: separator |
| 142 |
:default: ", " |
| 143 |
|
| 144 |
How to join multiple Discogs ``genres`` values when writing the beets |
| 145 |
``style`` field. |
| 146 |
|
| 147 |
.. versionchanged:: 2.7.0 |
| 148 |
|
| 149 |
This option now only applies to the ``style`` field as beets now only |
| 150 |
handles lists of ``genres``. |
| 151 |
|
| 152 |
.. conf:: strip_disambiguation |
| 153 |
:default: yes |
| 154 |
|
| 155 |
Discogs uses strings like ``"(4)"`` to mark distinct artists and labels with |
| 156 |
the same name. If you'd like to use the Discogs disambiguation in your tags, |
| 157 |
you can disable this option. |
| 158 |
|
| 159 |
.. conf:: featured_string |
| 160 |
:default: Feat. |
| 161 |
|
| 162 |
Configure the string used for noting featured artists. Useful if you prefer ``Featuring`` or ``ft.``. |
| 163 |
|
| 164 |
.. conf:: extra_tags |
| 165 |
:default: [] |
| 166 |
|
| 167 |
By default, beets will use only the artist and album to query Discogs. |
| 168 |
Additional tags to be queried can be supplied with the |
| 169 |
``extra_tags`` setting. |
| 170 |
|
| 171 |
This setting should improve the autotagger results if the metadata with the |
| 172 |
given tags match the metadata returned by Discogs. |
| 173 |
|
| 174 |
Tags supported by this setting: |
| 175 |
|
| 176 |
* ``barcode`` |
| 177 |
* ``catalognum`` |
| 178 |
* ``country`` |
| 179 |
* ``label`` |
| 180 |
* ``media`` |
| 181 |
* ``year`` |
| 182 |
|
| 183 |
Example: |
| 184 |
|
| 185 |
.. code-block:: yaml |
| 186 |
|
| 187 |
discogs: |
| 188 |
extra_tags: [barcode, catalognum, country, label, media, year] |
| 189 |
|
| 190 |
.. conf:: anv |
| 191 |
|
| 192 |
This configuration option is dedicated to handling Artist Name |
| 193 |
Variations (ANVs). Sometimes a release credits artists differently compared to |
| 194 |
the majority of their work. For example, "Basement Jaxx" may be credited as |
| 195 |
"Tha Jaxx" or "The Basement Jaxx". You can select any combination of these |
| 196 |
config options to control where beets writes and stores the variation credit. |
| 197 |
The default, shown below, writes variations to the artist_credit field. |
| 198 |
|
| 199 |
.. code-block:: yaml |
| 200 |
|
| 201 |
discogs: |
| 202 |
anv: |
| 203 |
artist_credit: yes |
| 204 |
artist: no |
| 205 |
album_artist: no |
| 206 |
|
| 207 |
Contributor credits |
| 208 |
~~~~~~~~~~~~~~~~~~~ |
| 209 |
|
| 210 |
When Discogs provides artist roles on a track, beets uses them to separate main |
| 211 |
artists from other credited contributors. Main artist fields such as ``artist``, |
| 212 |
``artists``, ``artist_credit``, ``artists_credit``, ``artist_id``, and |
| 213 |
``artists_ids`` keep the primary artist credits, while featured artists from |
| 214 |
track roles are appended using :conf:`plugins.discogs:featured_string`. |
| 215 |
|
| 216 |
Discogs contributor roles are also imported into beets' multi-value performer |
| 217 |
fields when available. This includes remixer, lyricist, composer, and arranger |
| 218 |
credits, which populate ``remixers``, ``lyricists``, ``composers``, and |
| 219 |
``arrangers`` respectively. |
| 220 |
|
| 221 |
.. include:: ./shared_metadata_source_config.rst |
| 222 |
|
| 223 |
.. _discogs guidelines: https://support.discogs.com/hc/en-us/articles/360005055373-Database-Guidelines-12-Tracklisting#Index_Tracks_And_Headings |
| 224 |
|
| 225 |
.. _divisions album: https://www.discogs.com/release/2026070-Handel-Sutherland-Kirkby-Kwella-Nelson-Watkinson-Bowman-Rolfe-Johnson-Elliott-Partridge-Thomas-The-A |
| 226 |
|
| 227 |
Troubleshooting |
| 228 |
--------------- |
| 229 |
|
| 230 |
Several issues have been encountered with the Discogs API. If you have one, |
| 231 |
please start by searching for `a similar issue on the repo |
| 232 |
<https://github.com/beetbox/beets/issues?utf8=%E2%9C%93&q=is%3Aissue+discogs>`_. |
| 233 |
|
| 234 |
Here are two things you can try: |
| 235 |
|
| 236 |
- Try deleting the token file (``~/.config/beets/discogs_token.json`` by |
| 237 |
default) to force re-authorization. |
| 238 |
- Make sure that your system clock is accurate. The Discogs servers can reject |
| 239 |
your request if your clock is too out of sync. |
| 240 |
|
| 241 |
Matching tracks by Discogs ID is not yet supported. The ``--group-albums`` |
| 242 |
option in album import mode provides an alternative to singleton mode for |
| 243 |
autotagging tracks that are not in album-related folders. |
| 244 |
|
| 245 |
.. _python3-discogs-client: https://github.com/joalla/discogs_client |