Lastgenre doesn't seem to work in my case, no genres added [solved]

When checking the imported and moved files I noticed that no genres were added to the files.
I’ve installed pylast with pip. And activated the plugin in config:

plugins: inline the lastgenre discogs chroma zero acousticbrainz fromfilename fetchart

I read on the forum that someone mentioned the Zero plugin as a cause of troubles. But I’ve configured the zero plugin with

zero:
    fields: comments
    update_database: true

So as far as I know it would only zero ‘comments’ not other fields.
I’d love ideas as to what could prevent the plugin from working.
Here is some verbose output:

beet -v import /Volumes/Tunez/Tunez/1\ Folder
user configuration: /Users/jpeeters/.config/beets/config.yaml
data directory: /Users/jpeeters/.config/beets
plugin paths: 
Sending event: pluginload
inline: adding item field multidisc
inline: adding item field my_samplerate
inline: adding item field is_flac
inline: adding album field format
inline: adding album field av_bitrate
library database: /Users/jpeeters/Music/Beets/musiclibrary.db
library directory: /Volumes/Stor/Tunez
Sending event: library_opened
Sending event: import_begin
Import of the directory:
/Volumes/Tunez/Tunez/1 Folder
was interrupted. Resume (Y/n)? n
Sending event: import_task_created
Sending event: import_task_start
Looking up: /Volumes/Tunez/Tunez/1 Folder/1 Giant Leap/1 Giant Leap
Tagging 1 Giant Leap - 1 Giant Leap
No album ID found.
Search terms: 1 Giant Leap - 1 Giant Leap
Album might be VA: False
Searching for MusicBrainz releases with: {'release': '1 giant leap', 'artist': '1 giant leap', 'tracks': '12'}
Requesting MusicBrainz release 2baa8bf4-5de1-3ba9-a615-d8a194ed48d5
primary MB release type: album
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (2baa8bf4-5de1-3ba9-a615-d8a194ed48d5)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release ea66040d-ad6c-41b4-b5c9-c1eb0263738a
Sending event: import_task_created
primary MB release type: album
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (ea66040d-ad6c-41b4-b5c9-c1eb0263738a)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release 28347a2e-ce7f-45a5-899e-d00d5828760c
primary MB release type: album
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (28347a2e-ce7f-45a5-899e-d00d5828760c)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release b79afe7c-7f2c-4516-a8bf-e34efa290c54
primary MB release type: album
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (b79afe7c-7f2c-4516-a8bf-e34efa290c54)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release c2cb3118-5511-4cfc-8826-239ef1e44950
Sending event: import_task_created
primary MB release type: album
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (c2cb3118-5511-4cfc-8826-239ef1e44950)
Computing track assignment...
...done.
Success. Distance: 0.03
discogs: Searching for master release 186744
Sending event: import_task_created
Sending event: import_task_created
discogs: Searching for master release 186744
Sending event: import_task_created
discogs: Searching for master release 186744
discogs: Searching for master release 186744
Sending event: import_task_created
discogs: Searching for master release 186744
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (67629)
Computing track assignment...
...done.
Success. Distance: 0.03
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (2994434)
Computing track assignment...
...done.
Success. Distance: 0.03
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (1958464)
Computing track assignment...
...done.
Success. Distance: 0.03
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (3494270)
Computing track assignment...
...done.
Success. Distance: 0.03
Sending event: albuminfo_received
Candidate: 1 Giant Leap - 1 Giant Leap (2751900)
Computing track assignment...
...done.
Success. Distance: 0.24
chroma: acoustid album candidates: 0
Evaluating 10 candidates.
Sending event: import_task_start

/Volumes/Tunez/Tunez/1 Folder/1 Giant Leap/1 Giant Leap (12 items)
Sending event: before_choose_candidate
Tagging:
    1 Giant Leap - 1 Giant Leap
Looking up: /Volumes/Tunez/Tunez/1 Folder/12 Tasty Grooves/12 Tasty Grooves
URL:
    https://musicbrainz.org/release/ea66040d-ad6c-41b4-b5c9-c1eb0263738a
Tagging The Interpretations - 12 Tasty Grooves
(Similarity: 100.0%) (CD, 2002, GB, Palm Pictures)
No album ID found.
Search terms: The Interpretations - 12 Tasty Grooves
Album might be VA: True
Searching for MusicBrainz releases with: {'release': '12 tasty grooves', 'artist': 'the interpretations', 'tracks': '13'}
 * Ma´ Africa                  -> Ma’ Africa
 * All Alone (On Eilean Shona) -> All Alone (on Eilean Shona)
Sending event: import_task_choice
Sending event: import_task_apply
0 of 12 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Requesting MusicBrainz release 3ead5bf0-d4f5-4b66-87ba-c52035a6d6e8
artresizer: method is (2, (7, 0, 8))
Sending event: import_task_created
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: album
secondary MB release type(s): compilation
Sending event: albuminfo_received
Candidate: Various Artists - The Big Cheese: 12 Tasty Grooves (3ead5bf0-d4f5-4b66-87ba-c52035a6d6e8)
Sending event: item_copied
Computing track assignment...
...done.
Sending event: database_change
Success. Distance: 0.12
Requesting MusicBrainz release 34a82747-8380-4728-98e3-a54819e740fa
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: album
Sending event: albuminfo_received
Candidate: The Shadows - Tasty (34a82747-8380-4728-98e3-a54819e740fa)
Computing track assignment...
...done.
Success. Distance: 0.60
Requesting MusicBrainz release f2077046-5d0b-4cc7-9d40-95b32686bd6c
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: import_task_created
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: other
Sending event: albuminfo_received
Candidate: Various Artists - Tasty - Urban Grooves (f2077046-5d0b-4cc7-9d40-95b32686bd6c)
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Computing track assignment...
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
...done.
Success. Distance: 0.90
Requesting MusicBrainz release 9cd80ce3-8522-4e0d-9f15-809cb9bc940f
Sending event: albuminfo_received
Candidate: Tycho Brahe - Tasty (9cd80ce3-8522-4e0d-9f15-809cb9bc940f)
Computing track assignment...
...done.
Success. Distance: 0.73
Requesting MusicBrainz release 40ca6293-1fab-4d7b-ad2c-c51b46c4b3e1
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
primary MB release type: album
Sending event: albuminfo_received
Candidate: Patti LaBelle - Tasty (40ca6293-1fab-4d7b-ad2c-c51b46c4b3e1)
Sending event: after_write
Computing track assignment...
...done.
Success. Distance: 0.71
Searching for MusicBrainz releases with: {'release': '12 tasty grooves', 'arid': '89ad4ac3-39f7-470e-963a-56509c546377', 'tracks': '13'}
the: "1 Giant Leap" -> "1 Giant Leap"
Sending event: import_task_created
Requesting MusicBrainz release 3ead5bf0-d4f5-4b66-87ba-c52035a6d6e8
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: album
secondary MB release type(s): compilation
Sending event: albuminfo_received
Candidate: Various Artists - The Big Cheese: 12 Tasty Grooves (3ead5bf0-d4f5-4b66-87ba-c52035a6d6e8)
Duplicate.
Requesting MusicBrainz release f2077046-5d0b-4cc7-9d40-95b32686bd6c
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: other
Sending event: albuminfo_received
Candidate: Various Artists - Tasty - Urban Grooves (f2077046-5d0b-4cc7-9d40-95b32686bd6c)
Duplicate.
Requesting MusicBrainz release 9cd80ce3-8522-4e0d-9f15-809cb9bc940f
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
Sending event: albuminfo_received
Candidate: Tycho Brahe - Tasty (9cd80ce3-8522-4e0d-9f15-809cb9bc940f)
Duplicate.
Requesting MusicBrainz release 40ca6293-1fab-4d7b-ad2c-c51b46c4b3e1
Sending event: import_task_created
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: album
Sending event: albuminfo_received
Candidate: Patti LaBelle - Tasty (40ca6293-1fab-4d7b-ad2c-c51b46c4b3e1)
Duplicate.
Requesting MusicBrainz release 987c040a-0004-40dc-ae69-ac6da66253e0
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
the: "1 Giant Leap" -> "1 Giant Leap"
primary MB release type: album
secondary MB release type(s): compilation
Sending event: albuminfo_received
Candidate: Various Artists - 12″ Club Classics: 80s Grooves (987c040a-0004-40dc-ae69-ac6da66253e0)
Computing track assignment...
...done.
Success. Distance: 0.76
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: import_task_files
Sending event: art_set
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Baaba Maal - 1 Giant Leap - Dunya Salam
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Robbie Williams & Maxi Jazz - 1 Giant Leap - My Culture
discogs: Searching for master release 176071
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Michael Stipe & Asha Bhosle - 1 Giant Leap - The Way You Dream
Sending event: import_task_created
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Mahotella Queens & Ulali - 1 Giant Leap - Ma’ Africa
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Speech & Neneh Cherry - 1 Giant Leap - Braided Hair
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Whirimako Black - 1 Giant Leap - Ta Moko
discogs: Searching for master release 176071
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Baaba Maal - 1 Giant Leap - Bushes
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Michael Franti - 1 Giant Leap - Passion
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Eddi Reader, Mahotella Queens & Revetti Sakalar - 1 Giant Leap - Daphne
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap - 1 Giant Leap - All Alone (on Eilean Shona)
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Grant‐Lee Phillips & Horace Andy - 1 Giant Leap - Racing Away
Sending event: database_change
acousticbrainz: getting data for: 1 Giant Leap feat. Eddi Reader - 1 Giant Leap - Ghosts
Sending event: import_task_created
Sending event: database_change
Sending event: album_imported
Sending event: albuminfo_received

And did you actually configure the lastgenre plugin?

Here’s my config. Works fine for me.

lastgenre:
    auto: yes
    canonical: yes
    count: 1
    force: yes
    source: album
    whitelist: yes
    min_weight: 10
    fallback:
    separator: ', '
    prefer_specific: no

Hi @dorade, no I did not add any extra settings in the config, but I was under the impression that defaults were used if not specifically configured. The defaults that I read in the docs fitted my needs.

To be certain I’ve pasted your settings into my config but even then when I import well known albums nothing gets added to the genre field. So I’m afraid that the problem lies in something else. Any ideas are most welcome.

Indeed. Must be something else. I saw in your other thread that you get unusual error messages. Maybe these two issues are related.

Yo! To get debugging messages from plugins during import, you need to use -vv instead of just -v.

You might also try running the lastgenre command in isolation to help isolate its behavior from the rest of the import process.

Hi @adrian, thanks for the hint to run it standalone. I ran the following command

$ beet -vv lastgenre /Volumes/Stor/Tunez/Albums/Tribe\ Called\ Quest\,\ A/Beats\,\ Rhymes\ and\ Life\ \(1996\)\ \(MP3\ 226\)

This gave the output below.
There seems to be a SSL: CERTIFICATE_VERIFY_FAILED error.
And a lot of lines from the zero plugin.
It suprised me though that running the plugin standalone still activated other plugins in my config. Maybe I did something wrong?

$ beet -vv lastgenre /Volumes/Stor/Tunez/Albums/Tribe\ Called\ Quest\,\ A/Beats\,\ Rhymes\ and\ Life\ \(1996\)\ \(MP3\ 226\) 
user configuration: /Users/jpeeters/.config/beets/config.yaml
data directory: /Users/jpeeters/.config/beets
plugin paths: 
Sending event: pluginload
inline: adding item field multidisc
inline: adding item field my_samplerate
inline: adding item field is_flac
inline: adding album field format
inline: adding album field av_bitrate
library database: /Users/jpeeters/Music/Beets/musiclibrary.db
library directory: /Volumes/Stor/Tunez
Sending event: library_opened
lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
lastgenre: genre for album A Tribe Called Quest - Beats, Rhymes and Life (None): 
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: write
zero: comments:  -> None
Sending event: after_write
Sending event: cli_exit

I’ve also dropped one of the files on MediaInfo to see what information is available in the file after processing. What caught my eye me is that genre (even as an empty field) isn’t in the file.

General
Complete name                            : /Volumes/Stor/Tunez/Albums/Tribe Called Quest, A/Beats, Rhymes and Life (1996) (MP3 226)/01-02 - Get a Hold.mp3
Format                                   : MPEG Audio
File size                                : 6.19 MiB
Duration                                 : 3mn 35s
Overall bit rate mode                    : Variable
Overall bit rate                         : 234 Kbps
Album                                    : Beats, Rhymes and Life
Album/Performer                          : A Tribe Called Quest
Part/Position                            : 1
Part/Total                               : 2
Track name                               : Get a Hold
Track name/Position                      : 2
Track name/Total                         : 15
Performer                                : A Tribe Called Quest
Performer/Sorted by                      : Tribe Called Quest, A
Thanks to                                : arranger
Publisher                                : Jive
Original/Released date                   : 1996-07-29
Recorded date                            : 1996-07-30
Writing library                          : LAME3.97 
BPM                                      : 95.16
Cover                                    : Yes
Cover MIME                               : image/jpeg
Initial key                              : Am
Media Type                               : 12" Vinyl
Script                                   : Latn
R128_ALBUM_GAIN                          : 0
R128_TRACK_GAIN                          : 0
CATALOGNUMBER                            : 01241-41587-1
MusicBrainz Album Type                   : album
REPLAYGAIN_TRACK_GAIN                    : 1.59 dB
REPLAYGAIN_TRACK_PEAK                    : 0.971283
MusicBrainz Album Status                 : Official
Artist Credit                            : A Tribe Called Quest
MusicBrainz Album Release Country        : US
ALBUMARTISTSORT                          : Tribe Called Quest, A
Album Artist Credit                      : A Tribe Called Quest
MusicBrainz Album Id                     : f906d3fd-7832-4018-a435-287cd9c50339
MusicBrainz Artist Id                    : 9689aa5a-4471-4fb4-9721-07cecda0fa9f
MusicBrainz Album Artist Id              : 9689aa5a-4471-4fb4-9721-07cecda0fa9f
MusicBrainz Release Group Id             : af2a22ae-15c9-3c73-9a35-7b4f503d8f7c
MusicBrainz Release Track Id             : 0a6a4c37-3efc-4693-99dd-f64686bfa328

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo
Duration                                 : 3mn 35s
Bit rate mode                            : Variable
Bit rate                                 : 234 Kbps
Minimum bit rate                         : 32.0 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Frame rate                               : 38.281 fps (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 6.02 MiB (97%)
Writing library                          : LAME3.97 
Encoding settings                        : -m j -V 0 -q 3 -lowpass 19.5 --vbr-new -b 32
Language                                 : English

When I open the MusicBrainz website for this song I can see that ‘hip hop’ is the genre.
https://musicbrainz.org/recording/898ac821-5d54-4bff-9eda-158d7e30f0f4

Does this information give you any idea as to how it can be that genre isn’t stored in the file?

Thanks, Jan

That certificate verification thing is the culprit! It’s hard to say how to fix it, however—it seems likely that your Python installation doesn’t have the latest certificates on your system, which is preventing it from communicating with Last.fm. Sorry I don’t have specific steps for how to resolve this, but that’s the underlying issue.

Thanks for clarifying. I’ll try to research if other Python apps have this communication problem and how they solve it.

I’ve found the following which might work. I’m on macOS with python 3.7.1. Will test over the weekend and report back.

If you have installed Python 3.6 on OSX and are getting the “SSL: CERTIFICATE_VERIFY_FAILED” error when trying to connect to an https:// site, it’s probably because Python 3.6 on OSX has no certificates at all, and can’t validate any SSL connections. This is a change for 3.6 on OSX, and requires a post-install step, which installs the certifi package of certificates. This is documented in the ReadMe, which you should find at /Applications/Python\ 3.6/ReadMe.rtf The ReadMe will have you run this post-install script, which just installs certifi: /Applications/Python\ 3.6/Install\ Certificates.command Release notes have some more info: Python Release Python 3.6.0 | Python.org

From the following page:

The solution for Python 3.x on macOS is this:

When you install the official macOS Python package from: https://www.python.org/downloads/mac-osx/
it installs a ‘Python 3.x’ folder in your Applications folder.
In this folder you’ll find

Install Certificates.command

Running this command installs all the necessary certificates for Python and thus Lastgenre to be able to communicate correctly with Last.fm.

Amazing, this worked for me too!