Commit 37d60dd
authored
Populate extra artists for discogs (#6509)
## Discogs: Populate multi-value contributor fields from artist roles
Fixes: #6380
This PR extends the Discogs plugin to properly populate beets'
`remixers`, `lyricists`, `composers`, and `arrangers` fields from
Discogs artist role credits.
### What changed
**`beetsplug/discogs/states.py`** — Core logic change in `ValidArtist`
and `ArtistState`:
- The `is_feat: bool` field on `ValidArtist` is replaced with `role:
str`, preserving the raw Discogs role string rather than discarding it
after a single boolean check.
- A new `main_artists` property filters to artists with no role or a
featuring role — this replaces the previous filtering that happened at
parse time, so `valid_artists` now includes _all_ artists regardless of
role.
- `artists`, `artists_credit`, and `artists_ids` are updated to source
from `main_artists` instead of `valid_artists`, ensuring non-primary
contributors (e.g. composers, arrangers) no longer appear in artist
identity fields.
- New properties — `lyricists`, `arrangers`, `remixers`, `composers` —
derive their values from `valid_artists` by substring-matching on the
`role` field (e.g. `"lyrics"`, `"producer"`, `"remix"`, `"written-by"`).
**`beetsplug/discogs/types.py`** — `ArtistInfo` typed dict gains four
optional fields: `arrangers`, `composers`, `remixers`, `lyricists`.
### Test changes
- `test_anv` is refactored from a flat parametrised function into a
`TestAnv` class with a shared `album_info` fixture, splitting the
assertions across focused test methods per field group.
- `test_parse_featured_artists` gains assertions for `artists_ids` and
`composers`.
- A new `test_parse_extraartist_roles` test covers role-to-field mapping
end-to-end for all four contributor types.
### Impact
Discogs imports now populate contributor fields that were previously
only filled by the MusicBrainz plugin.File tree
6 files changed
+243
-147
lines changed- .github
- beetsplug/discogs
- docs
- plugins
- test/plugins
6 files changed
+243
-147
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | 119 | | |
125 | 120 | | |
126 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
130 | | - | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
140 | | - | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
145 | | - | |
| 147 | + | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
157 | 181 | | |
158 | 182 | | |
159 | 183 | | |
| |||
162 | 186 | | |
163 | 187 | | |
164 | 188 | | |
165 | | - | |
166 | | - | |
| 189 | + | |
| 190 | + | |
167 | 191 | | |
168 | 192 | | |
169 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
207 | 221 | | |
208 | 222 | | |
209 | 223 | | |
| |||
0 commit comments