beets: Beatport plugin does not apply tags to file

Problem

Continuation of issue #2080 The beatport plugin fetches genres, bpm and musical_key among others. These should be shown when querying using beat ls ... and written into the tags of the music files. However, genre is not applied, bpm is correctly applied and written to tags and musical_key is applied but not written to tags.

During writing this bug report I found that I did not pass the attribute self.genre to the hook. This explains why genre was not applied but not why musical_key is not written to tags.

I will issue a pull request resolving the first bug but I don’t know why `musical_key_ is not written to the tags.

Reproducing

Deleting with a tag editor genre and bpm beforehand.

First, we import the album in timid (-t) mode:

$ beet -vv import ~/music -t

Output:

user configuration: /home/temrix/.config/beets/config.yaml
data directory: /home/temrix/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/temrix/Dokumente/musiclibrary.db
library directory: /home/temrix/music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/temrix/music/Supersillyus - Charade - 2016 - MP3
Tagging Supersillyus - Charade
No album ID found.
Search terms: Supersillyus - Charade
Album might be VA: False
Searching for MusicBrainz releases with: {'release': 'charade', 'artist': 'supersillyus', 'tracks': '6'}
Requesting MusicBrainz release 311af76c-3c77-4603-8b64-b4de17ee6c3a
primary MB release type: album
Sending event: albuminfo_received
Candidate: Supersillyus - Charade (311af76c-3c77-4603-8b64-b4de17ee6c3a)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release 8613ba08-2700-48bc-8a2c-349a81e37a31
primary MB release type: album
Sending event: albuminfo_received
Candidate: Supersillyus - Tesselations (8613ba08-2700-48bc-8a2c-349a81e37a31)
Computing track assignment...
...done.
Success. Distance: 0.70
Requesting MusicBrainz release 8ff531fd-198c-4188-9a60-0eff01591153
primary MB release type: album
Sending event: albuminfo_received
Candidate: Supersillyus - Interabang‽ (8ff531fd-198c-4188-9a60-0eff01591153)
Computing track assignment...
...done.
Success. Distance: 0.58
Requesting MusicBrainz release a39d17fc-78c2-3daf-bc8e-c5408580423d
primary MB release type: album
secondary MB release type(s): soundtrack
Sending event: albuminfo_received
Candidate: Henry Mancini - Charade (a39d17fc-78c2-3daf-bc8e-c5408580423d)
Computing track assignment...
...done.
Success. Distance: 0.72
Requesting MusicBrainz release 8770c677-9199-4d97-867b-1a28804a3728
primary MB release type: single
Sending event: albuminfo_received
Candidate: Skids - Charade (8770c677-9199-4d97-867b-1a28804a3728)
Computing track assignment...
...done.
Success. Distance: 0.60
Sending event: albuminfo_received
Candidate: Supersillyus - Charade (1742984)
Computing track assignment...
...done.
Success. Distance: 0.12
Evaluating 6 candidates.

/home/temrix/music/Supersillyus - Charade - 2016 - MP3 (6 items)
Sending event: before_choose_candidate
Tagging:
    Supersillyus - Charade
URL:
    https://musicbrainz.org/release/311af76c-3c77-4603-8b64-b4de17ee6c3a
(Similarity: 100.0%) (Digital Media, 2016, XW, Gravitas Recordings, GR089)
 * Mirage a Trois ->
   Mirage à Trois
 * A List of Instructions for When I'm Human ->
   A List of Instructions for When I’m Human
[A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? m
Finding tags for album "Supersillyus - Charade".
Candidates:
1. Supersillyus - Charade (100.0%) (Digital Media, 2016, XW, Gravitas Recordings, GR089)
2. Supersillyus - Charade (88.1%) (tracks, source) (Beatport, Digital, 2016, Gravitas Recordings, GR089)
3. Supersillyus - Interabang‽ (41.8%) (tracks, album, unmatched tracks, ...) (Digital Media, 2013, US)
4. Skids - Charade (39.9%) (tracks, unmatched tracks, artist, ...) (7" Vinyl, 1979, GB, Virgin, VS 288)
5. Supersillyus - Tesselations (29.7%) (tracks, missing tracks, album, ...) (Digital Media, 2011, US, Base Trip Records, [none])
6. Henry Mancini - Charade (28.0%) (tracks, missing tracks, artist, ...) (CD, 1998, ES, RCA Victor)
# selection (default 1), Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? 2
Tagging:
    Supersillyus - Charade
URL:
    https://beatport.com/release/charade/1742984
(Similarity: 88.1%) (tracks, source) (Beatport, Digital, 2016, Gravitas Recordings, GR089)
 * Mirage a Trois ->
   Mirage a Trois (source)
 * Aeon Bahamut ->
   Aeon Bahamut (source)
 * Trancendental Medication ->
   Trancendental Medication (source)
 * A List of Instructions for When I'm Human ->
   A List of Instructions for When I'm Human (source)
 * The Great Shenanigan ->
   The Great Shenanigan (source)
 * Charade ->
   Charade (source)
Apply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? a
Sending event: import_task_choice
Sending event: import_task_apply
0 of 6 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: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
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: import_task_files
Sending event: album_imported
Sending event: import
Sending event: cli_exit

After that:

$ beet -vv ls -f '$title - $genre - $bpm - $musical_key'
user configuration: /home/temrix/.config/beets/config.yaml
data directory: /home/temrix/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/temrix/Dokumente/musiclibrary.db
library directory: /home/temrix/music
Sending event: library_opened
Mirage a Trois - Downtempo - 90 - Gmin
Aeon Bahamut - Downtempo - 100 - Gmaj
Trancendental Medication - Downtempo - 141 - Fmaj
A List of Instructions for When I'm Human - Downtempo - 88 - Amin
The Great Shenanigan - Downtempo - 123 - E♭maj
Charade - Downtempo - 123 - Amaj
Sending event: cli_exit

genre is left unaltered but should be changed to Glitch Hop, bpm is correct and written to tags, musical_key is correct and not written to tags.

We run this:

$ beet -vv ls -af '$album - $genre'

Album genre has not changed.

user configuration: /home/temrix/.config/beets/config.yaml
data directory: /home/temrix/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/temrix/Dokumente/musiclibrary.db
library directory: /home/temrix/music
Sending event: library_opened
Charade - Downtempo
Sending event: cli_exit

Here’s a link to the music files that trigger the bug (if relevant): Simple free download link to files, Creative Commons licensed, and also available in the Beatport catalogue: https://ektoplazm.com/free-music/supersillyus-charade

Setup

  • OS: Debian
  • Python version: 3.7.3
  • beets version: 1.5.0
  • Turning off plugins made problem go away (yes/no): yes
  • Tagging program used to read tags: Musicbrainz Picard

My configuration (output of beet config) is:

directory: ~/music
library: ~/Dokumente/musiclibrary.db

import:
    copy: yes
    write: yes

ui:
    color: yes

plugins: beatport
beatport:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: beatport_token.json
    source_weight: 0.5

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@sampsyo How exactly does the singleton mode work or where can I look it up?

Hi! Anything in particular you’re interested in knowing? The idea is pretty straightforward—tracks are tagged one at a time instead of as entire albums.

Thanks for the writeup!

musical_key is not written to the files because it’s a flexible attribute that was invented just for the Beatport plugin, so it doesn’t have a tag mapping. In retrospect, the right field name to have used is initial_key, which you’ll find (if you grep around in the codebase) is a pre-existing field used by multiple other plugins—namely, keyfinder and acousticbrainz. Let’s switch to using that instead!