Help fetching discogs 'Style' and mapping to write to "Genre" field

Hi all,

I am completely new to beets, python, coding in general.

I have installed the discogs plugin on OSX and would like to fetch discogs’ “style” field, and write it to the genre field of the tracks, exactly as-is. eg.:

Ambient, Techno, Breakbeat

Is this possible? I saw this post , but didn’t quite understand if they ever achieved it.

Any help is much appreciated! :pray:

Does anyone have an idea?

Hi! Just checking, are you (a) on the latest source and (b) using the discogs plugin? This is the PR where the feature seems to have been added:

Hey! That’s what I thought, bit confused here.

Here is my pip list:

Package Version

audioread 2.1.9
beatport 0.0.1
beets 1.5.0
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
confuse 1.3.0
discogs-client 2.3.0
ffmpeg 1.4
Flask 1.1.2
Flask-Cors 3.0.9
idna 2.10
itsdangerous 1.1.0
jellyfish 0.8.2
Jinja2 2.11.2
MarkupSafe 1.1.1
mediafile 0.6.0
munkres 1.1.4
musicbrainzngs 0.7.1
mutagen 1.45.1
oauthlib 3.1.0
pip 20.2.4
pyacoustid 1.2.0
PyYAML 5.3.1
requests 2.24.0
requests-oauthlib 1.3.0
setuptools 49.2.1
six 1.15.0
Unidecode 1.1.1
urllib3 1.25.11
Werkzeug 1.0.1

The feature that @adrian mentioned was implemented after the last release of beets. The last release is 1.4.9, though. It seems that you have somehow installed a development version (1.5.0). Assuming that version is sufficiently recent, you’d still need to copy style to genre. Off-hand, I don’t know what’s the best way to do that.

I see, so do you mean the discogs plugin is pulling the Style field, but not writing to the genre field, I would need to find a way to do this?

I’m not familiar with the discogs plugin, so I may be wrong. But yes, that’s the impression that I got from a brief glance at the github issue that was linked above. It seems that discogs has separate concepts of genre and style and the plugin does so, too.

You can use beet list -f '$album - $title - $style' <query> to see whether the style field is set on your music.

[…] but not writing to the genre field, I would need to find a way to do this?

Actually, that might not be possible at all using beets alone. It’s a feature that has been requested before, but nobody got around to implementing it:

That’s a shame! For me, Discogs has the most comprehensive approach to Genre, unfortunately they called it ‘Style’. The actual genre field is so broad!

I hear ya!
Hence a friend of mine made a cool python script to do exactly this.
For Windows, check out:
For macOS, check out:

What a great script! Unfortunately for me, it only seems to find a couple of tracks when searching, even when manually typing in the same search query on the discogs webpage, eg. ‘Jamson Peer Du’ returns the correct results…

Aww bummer.
I think I know why that is…
This script is looking up the MASTER release.

Since ‘Jamson Peer Du’ doesn’t seem to have one, it cant fetch the data:

Ah I see! So it doesn’t work with compilations / V/As?

you could try to change line 255:

res ='master', artist=self.artist, track=self.title)


res ='release', artist=self.artist, track=self.title)

lemme know if that helps!

Strange! Had the same issue with the same tracks (even with beets), then I got hold of some new music and it worked fine with that! I guess, even if it works most of the time, it’s still saving me a ton of time! I’ll run it through a larger selection at some point and see how it handles. Thank you so much!!! :slight_smile:

1 Like

I just tested it with that Peer Du - Jamson track, and was able to find it by altering the script.

See proof:


Change line 255 in the sourcecode from:
res ='master', artist=self.artist, track=self.title)
res ='{self.title} {self.artist}')

It will search anywhere, so prolly will detect your track, but might also bring up more false positives.

Lemme know how that worked out for you.

Unfortunately it didn’t seem to make any difference. I tried 2 different compilations and 1 EP. Could it be struggling to pull from compilations and V/As?

It did make the difference for me.
Are you using the compiled version?
If so, changing the sourcecode won’t have any effect on it, ofcourse.

To use the sourcecode you need to have Python3 installed.
Python 3.7 was used when this script was made, so perhaps best to install that version.

  1. Open up Terminal (or CMD)
  2. then do a pip3 install -r requirements.txt while you’re in the folder where the sourecode file is.
  3. and run your altered version with python3

Thank you for your help and patience!

I now get this error:

Searching: Jamson Peer Du
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 1342, in do_open
h.request(req.get_method(), req.selector,, headers,
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 1010, in _send_output
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 950, in send
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/”, line 1424, in connect
self.sock = self._context.wrap_socket(self.sock,
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/”, line 500, in wrap_socket
return self.sslsocket_class._create(
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/”, line 1040, in _create
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/”, line 1309, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users//Downloads/discogs-tag-updater/discogs_tag 2/", line 439, in
File "/Users/
/Downloads/discogs-tag-updater/discogs_tag 2/”, line 351, in main
File “/Users//Downloads/discogs-tag-updater/discogs_tag 2/", line 149, in save
File "/Users/
/Downloads/discogs-tag-updater/discogs_tag 2/”, line 208, in _image_flac = urlopen(self.image).read()
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 214, in urlopen
return, data, timeout)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 517, in open
response = self._open(req, data)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 494, in _call_chain
result = func(*args)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 1385, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/”, line 1345, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)>
**-MacBook-Pro-2:~ ***$

I’ve already tried making a new discogs_tag.ini and generated a new token too!

Now I get this as well as the previous error:

Searching: Somewhere Now B12
Traceback (most recent call last):
File “/Users//Downloads/discogs-tag-updater/discogs_tag 2/", line 439, in
File "/Users/
/Downloads/discogs-tag-updater/discogs_tag 2/”, line 349, in main
if is None:
File “/Users/***/Downloads/discogs-tag-updater/discogs_tag 2/”, line 264, in search
d_title = track.title
AttributeError: ‘Label’ object has no attribute ‘title’
***-MacBook-Pro-2:~ ***$

I see you are running python 3.9
Make sure 3.7 is installed instead.