Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 407
    • Issues 407
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhalefunkwhale
  • funkwhalefunkwhale
  • Issues
  • #1846
Closed
Open
Issue created Aug 14, 2022 by Sam Birch@porcupine_club

import_files seems to get confused between Artist and Album Artist when handling MBIDs in compilation albums

Steps to reproduce

  1. Run an in-place import from the CLI of a directory containing certain files that I have in my library: docker-compose run --rm api python manage.py import_files --recursive --replace --in-place --prune --no-input a48fe69b-2993-4ab7-b894-93f7b097ba29 /music/Music
  2. Observe import output.
  3. Observe server output.

What happens?

Certain tracks in my library consistently give a Duplicate key violation for metadata. Skipping... error. It seems to affect all tracks in some compilation albums. All tracks in my library have been tagged with MusicBrainz Picard, so they should have fairly clean metadata.

What is expected?

Metadata is updated successfully. (Or actually, no updates occur because the metadata was imported correctly to begin with.)

Context

Funkwhale version(s) affected: 1.2.7 (using multi-container Docker setup)

Here's an example of a track triggering the issue:

Import job output:

  File #28580 at file:///music/Music/Various Artists/The Hamilton Mixtape [2016]/06 Sia feat. Miguel & Queen Latifah - Satisfied.mp3 was modified, updating metadata…
  Duplicate key violation for metadata. Skipping...
file:///music/Music/Various Artists/The Hamilton Mixtape [2016]/06 Sia feat. Miguel & Queen Latifah - Satisfied.mp3

Database output:

2022-08-12 14:37:17.125 UTC [1898] STATEMENT:  UPDATE "music_artist" SET "mbid" = '89ad4ac3-39f7-470e-963a-56509c546377'::uuid, "name" = 'Sia' WHERE "music_artist"."id" = 1541
2022-08-12 14:37:17.131 UTC [1898] ERROR:  duplicate key value violates unique constraint "music_artist_mbid_0b814e0b_uniq"
2022-08-12 14:37:17.131 UTC [1898] DETAIL:  Key (mbid)=(89ad4ac3-39f7-470e-963a-56509c546377) already exists.

Here is this track's metadata (via kid3-cli -c 'get all' '/music/Music/Various Artists/The Hamilton Mixtape [2016]/06 Sia feat. Miguel & Queen Latifah - Satisfied.mp3'):

File: MPEG 1 Layer 3 255 kbps 44100 Hz Joint Stereo 5:18
  Name: 06 Sia feat. Miguel & Queen Latifah - Satisfied.mp3
Tag 1: ID3v1.1
  Title         Satisfied
  Artist        Sia feat. Miguel & Queen Latif
  Album         The Hamilton Mixtape
  Date          2016
  Track Number  6
Tag 2: ID3v2.4.0
  Title                              Satisfied
  Artist                             Sia feat. Miguel & Queen Latifah
  Album Artist                       Various Artists
  Album                              The Hamilton Mixtape
  Track Number                       6/23
  Date                               2016-12-02
  Composer                           Lin‐Manuel Miranda
  Disc Number                        1/1
  Performer                          bass synthesizer|Mike Elizondo|keyboard|Mike Elizondo|keyboard|Tony Esterly|keyboard|Patrick Warren|guitar|Tony Esterly|piano|Patrick Warren
  Arranger                           engineer|Brent Arrowood|engineer|John Hanes|engineer|Adam Hawkins|engineer|Alonzo Lazaro|mix|Serban Ghenea|producer|Mike Elizondo|producer|Tony Esterly|arranger|Alex Lacamoire
  Compilation                        1
  ISRC                               USAT21603219
  Language                           eng
  Lyricist                           Lin‐Manuel Miranda
  Media                              Digital Media
  Original Date                      2016-12-02
  Publisher                          Atlantic
  Sort Composer                      Miranda, Lin‐Manuel
  ARTISTS                            Sia
  Acoustid Id                        abbbf357-50d8-4758-9dbe-4215eb5c588f
  BARCODE                            075679922311
  MusicBrainz Album Artist Id        89ad4ac3-39f7-470e-963a-56509c546377
  MusicBrainz Album Id               af552aa5-6ed7-413e-9fc6-c6cdb25bd414
  MusicBrainz Album Release Country  XW
  MusicBrainz Album Status           official
  MusicBrainz Album Type             album
  MusicBrainz Artist Id              2f548675-008d-4332-876c-108b0c7ab9c5
  MusicBrainz Release Group Id       e54f1eef-b8cf-488e-8921-555960c62fb8
  MusicBrainz Release Track Id       a242f101-17a9-4d96-927f-ed8f6b215d34
  MusicBrainz Work Id                3ac3f0d2-8c53-4ee5-87d7-da90fec74458
  SCRIPT                             Latn
  WORK                               Satisfied
  originalyear                       2016
  File ID: musicbrainz               e948a4b9-7ccc-4282-b2f5-94647ef171bf

The MBID 89ad4ac3-39f7-470e-963a-56509c546377, which I assume Funkwhale is taking from the track's "MusicBrainz Album Artist Id" tag, is for Various Artists. This matches the track's "Album Artist" tag.

In my database, music_artist 1541 is:

  id  |                 mbid                 |         creation_date         |   name    |                 uuid                 |                                              fid                                               | from_activity_id | attributed_to_id |    body_text     | description_id | attachment_cover_id | content_category |       modification_date
------+--------------------------------------+-------------------------------+-----------+--------------------------------------+------------------------------------------------------------------------------------------------+------------------+------------------+------------------+----------------+---------------------+------------------+-------------------------------
 1541 | 80b3cf5e-18fe-4c59-98c7-e5bb87210710 | 2022-03-20 19:22:21.234436+00 | The Roots | d019e552-fbf3-4876-a915-f5c7933147f7 | https://funkwhale.porcupine.club/federation/music/artists/d019e552-fbf3-4876-a915-f5c7933147f7 |                  |                2 | 'root':2 'the':1 |                |                     | music            | 2022-03-20 19:22:21.234489+00

Note that the name for this artist is set to "The Roots", which is the first value from the "Artist" tag (not the "Album Artist" tag) of first track of the same album that this Sia track is on.

My theory is that Funkwhale is not always consistent about whether is uses the Artist MBID or the Album Artist MBID when creating music_artist records. I started digging into the source for the import_files process, but I wasn't able to identify anything that was obviously wrong.

Another possibility is that this is a migration issue. I initially imported this library when I was running Funkwhale 1.2.3 maybe? It's been at least a few point upgrades. Maybe this behavior changed at some point and the incorrectly-paired artist MBIDs are names are left over from that.

Assignee
Assign to
Time tracking